Changeset 64 in Sophya


Ignore:
Timestamp:
Dec 22, 1997, 5:54:25 PM (28 years ago)
Author:
aubourg
Message:

Portage Mac, 22/12/97

Location:
trunk/SophyaPI/PI
Files:
6 added
21 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PI/piapplmac.cc

    r34 r64  
    1111#include <SIOUX.h>
    1212#include <LAttachment.h>
     13
     14class PIInit {
     15public:
     16  PIInit() {
     17    SIOUXSettings.initializeTB = false;
     18    SIOUXSettings.standalone = false;
     19    SIOUXSettings.setupmenus = false;
     20    SIOUXSettings.showstatusline = true;
     21  }
     22};
     23
     24PIInit piInit;
    1325
    1426class PISIOUXAttachment : public LAttachment {
     
    5264        new LGrowZone(20000);                   // Install a GrowZone function to catch
    5365                                                                        //    low memory situations.
     66                                                                       
     67                // Register functions to create core PowerPlant classes
     68       
     69        RegisterAllPPClasses();
    5470
    5571        macAppli = new PIPPApplMac;
     
    5773       
    5874    menubar = new PIMenubar(this, "DefMenubar");
    59     topcont = new PIWindowMac(this, "TopLevel", PIWindowKind(2), sx, sy, 10, 45);
     75    topcont = new PIWindowMac(this, "TopLevel", PIWK_floating, sx, sy, 10, 45);
    6076}
    6177
  • trunk/SophyaPI/PI/pibwdgmac.cc

    r63 r64  
    6969}
    7070
     71/* --Methode-- */
     72void PIBaseWdgMac::DrawOpaqueString(int x, int y, char* s, int /*pos*/)
     73{
     74  if (mPane->FocusDraw()) {
     75    LocalToMacPortPoint(x, y, x, y);
     76    ::MoveTo(x, y);
     77    LStr255 ps = s;
     78    ::TextFont(applFont);
     79        Rect box;
     80        box.left = x;
     81        box.bottom = y;
     82        int iWidth = TextWidth(s,0,strlen(s));
     83        box.right = box.left + iWidth;
     84        int z;
     85        box.top = box.bottom + GetFontHeight(z,z);
     86    ::TETextBox(s,strlen(s),&box,teForceLeft);
     87  }
     88}
    7189
    7290/* --Methode-- */
     
    518536
    519537
     538
     539void PIBaseWdgMac::DrawPixmap(int x, int y, unsigned char *pix,
     540                            int sx, int sy, PIColorMap* cmap)
     541{
     542  Rect  frame;
     543  SetRect(&frame, 0, 0, sx, sy);
     544  Rect dstFrame;
     545  SetRect(&dstFrame, x, y, sx, sy);
     546  GWorldPtr gWorld;
     547  ThrowIfOSErr_(NewGWorld(&gWorld, 8, &frame, cmap->GetCTab(), nil, 0));
     548  PixMapHandle pmh = GetGWorldPixMap(gWorld);
     549  ::LockPixels (pmh);
     550  Ptr pmap = GetPixBaseAddr(pmh);
     551  memcpy(pmap, pix, sx*sy);
     552  ::ForeColor (blackColor);
     553  ::BackColor (whiteColor);
     554  ::CopyBits((BitMap *) (*pmh),
     555                                &mPane->GetMacPort()->portBits,
     556                                &frame, &dstFrame, srcCopy, nil);
     557  ::UnlockPixels (pmh);
     558  DisposeGWorld(gWorld);
     559}
     560
     561void PIBaseWdgMac::SetClipRectangle(int x0, int y0, int dx, int dy)
     562{  // $CHECK$
     563}
     564
     565void PIBaseWdgMac::ClearClipRectangle()
     566{ // $CHECK$
     567}
     568
     569/* --Methode-- */
     570int PIBaseWdgMac::GetFontHeight(int& asc, int& desc)   
     571{
     572  if (mPane->FocusDraw()) {
     573    FontInfo info;
     574    GetFontInfo(&info);
     575    asc = info.ascent;
     576    desc = info.descent;
     577    return (asc + desc);
     578  } else {
     579    return 0;
     580  }
     581}
  • trunk/SophyaPI/PI/pibwdgmac.h

    r63 r64  
    3737  virtual void       DrawMarker(int x0, int y0);
    3838  virtual void       DrawMarkers(int *x, int *y, int n);
     39 
     40  virtual void       DrawPixmap(int x, int y, unsigned char *pix,
     41                            int sx, int sy, PIColorMap* cmap);
    3942
    4043  virtual int        CalcStringWidth(char const* s); 
     
    5053  virtual void       SelMarker(int msz, PIMarker mrk=PI_DotMarker);
    5154
     55// Selection de zone de trace (clip)
     56  virtual void       SetClipRectangle(int x0, int y0, int dx, int dy);
     57  virtual void       ClearClipRectangle();
    5258
    5359// Acces aux attributs graphiques
     
    6167  virtual PIMarker   GetMarker();
    6268  virtual int        GetMarkerSize();
     69  virtual int        GetFontHeight(int& asc, int& desc);
    6370
    6471
  • trunk/SophyaPI/PI/picmapgen.h

    r63 r64  
    2828  virtual void FreeColors()=0;     // Desalloue les couleurs
    2929
    30   virtual int   TotNbColors()=0;    // Donne le nombre total de couleurs disponibles
     30  virtual long   TotNbColors()=0;   // Donne le nombre total de couleurs disponibles
    3131  virtual int   NbAllocColors()=0;  // Nb de couleurs deja allouees
    3232protected:
  • trunk/SophyaPI/PI/picmapmac.cc

    r63 r64  
    22#include <UDebugging.h>
    33
    4 PIColorMapMac::PIColorMapMac(CMapId id)
    5 : PIColorMapGen(id), mPalette(NULL), mCTab(NULL)
     4static int NTotAllocCol;
     5
     6
     7PIColorMapMac::PIColorMapMac()
     8: PIColorMapGen(), mPalette(NULL), mCTab(NULL)
    69{
    710}
    811
    9 PIColorMapMac::PIColorMapMac(CMapId id, int i)       // Fait une veritable allocation
    10 : PIColorMapGen(id,i)
     12PIColorMapMac::PIColorMapMac(int id, int nc, string const& nom)
     13: PIColorMapGen(id, nc, nom)
    1114{
    12     int n = nCols[id-1];
     15    int n = nc+2;
    1316        mCTab = (CTabHandle) ::NewHandle(sizeof(long) +
    1417                                sizeof(short) + sizeof(short) +
    15                                 256L*sizeof(ColorSpec));
     18                                n*sizeof(ColorSpec));
    1619        (**mCTab).ctFlags = 0;
    1720        (**mCTab).ctSeed = GetCTSeed();
    18         (**mCTab).ctSize = n+2;
     21        (**mCTab).ctSize = n;
    1922    ColorSpec* sp = (**mCTab).ctTable;
    2023    sp[0].rgb.red   = 0;
     
    2629    sp[1].rgb.blue  = 65535;
    2730    sp[1].value     = 1;
     31    for (int i=2; i<n; i++) {
     32      sp[i].rgb.red   = 0;
     33      sp[i].rgb.green = 0;
     34      sp[i].rgb.blue  = 0;
     35      sp[i].value     = i;
     36    }
     37  mPalette = NewPalette(mNCol,mCTab,pmTolerant,0);
    2838}
    2939
    30 
    31 PIColorMapMac::PIColorMapMac(string const& nom, int nCol)
    32 : PIColorMapGen(nom, nCol)
     40PIColorMapMac::~PIColorMapMac()
    3341{
    34         mCTab = (CTabHandle) ::NewHandle(sizeof(long) +
    35                                 sizeof(short) + sizeof(short) +
    36                                 256L*sizeof(ColorSpec));
    37         (**mCTab).ctFlags = 0;
    38         (**mCTab).ctSeed = GetCTSeed();
    39         (**mCTab).ctSize = nCol+2;
    40     ColorSpec* sp = (**mCTab).ctTable;
    41     sp[0].rgb.red   = 0;
    42     sp[0].rgb.green = 0;
    43     sp[0].rgb.blue  = 0;
    44     sp[0].value     = 0;
    45     sp[1].rgb.red   = 65535;
    46     sp[1].rgb.green = 65535;
    47     sp[1].rgb.blue  = 65535;
    48     sp[1].value     = 1;
     42  DisposePalette(mPalette);
     43  DisposeHandle((Handle)mCTab);
    4944}
    5045
     
    5853  return(picr);
    5954
    60 ColorSpec& sp = (**mCTab).ctTable[n+2];
    61 picr.red   = sp.rgb.red;
    62 picr.green = sp.rgb.green;
    63 picr.blue  = sp.rgb.blue;
     55RGBColor qdCol;
     56GetEntryColor(mPalette,n+2,&qdCol);
     57
     58picr.red   = qdCol.red;
     59picr.green = qdCol.green;
     60picr.blue  = qdCol.blue;
    6461
    6562return(picr);
     
    6966bool PIColorMapMac::AllocColor(PIColor const& col, int index)
    7067{
    71   ColorSpec& sp = (**mCTab).ctTable[index+2];
    72   sp.rgb.red   = col.red;
    73   sp.rgb.green = col.green;
    74   sp.rgb.blue  = col.blue;
    75   sp.value     = index+2;
     68  if (!mPalette) return false;
     69  if ((index < 0) || (index > mNCol))  return(false);
     70 
     71  RGBColor srcRGB;
     72  srcRGB.red   = col.red;
     73  srcRGB.green = col.green;
     74  srcRGB.blue  = col.blue;
     75 
     76  SetEntryColor(mPalette,index+2,&srcRGB);
     77  ((**mCTab).ctTable)[index+2].rgb = srcRGB;
     78  NTotAllocCol++;
    7679  return true;    //  $CHECK$  retourne true si OK - Reza 01/12/97
    7780}
    7881
    79 void PIColorMapMac::MakeColMap()
     82long PIColorMapMac::TotNbColors()
    8083{
    81   PIColorMapGen::MakeColMap();
    82   mPalette = NewPalette(mNCol,mCTab,pmTolerant,0);
     84   PixMapHandle pmh = ((CGrafPort*)qd.thePort)->portPixMap;
     85   int depth = (**pmh).cmpSize * (**pmh).cmpCount;
     86   long nbcol = 1;
     87   for (int i=0; i<depth; i++)
     88     nbcol *= 2;
     89   return nbcol;
    8390}
    8491
     
    9097}
    9198
     99int PIColorMapMac::NbAllocColors()
     100{
     101return(NTotAllocCol);
     102}
     103
     104
    92105void PIColorMapMac::CopyFrom(PIColorMapGen* x)
    93106{
  • trunk/SophyaPI/PI/picmapmac.h

    r63 r64  
    88class PIColorMapMac : public PIColorMapGen {
    99public:
    10   friend class PIColorMapGen;
    11   friend class PIPixmapMac;
    12   PIColorMapMac(CMapId);
    13   PIColorMapMac(string const& nom, int nCol);
     10  PIColorMapMac();
     11  PIColorMapMac(int id, int nc, string const& nom); 
     12  ~PIColorMapMac();
     13 
    1414  virtual PIColor GetColor(int n);
    1515  virtual bool AllocColor(PIColor const& col, int index);   // $CHECK$  Reza 01/12/97(Modif)
    1616  virtual void FreeColors();
    17   virtual void MakeColMap();
    18   virtual int  TotNbColor();         // A faire   $CHECK$  Reza 01/12/97
    19   virtual int  NbAllocColors();      // A faire       "    "     "
     17
     18  virtual long  TotNbColors();
     19  virtual int   NbAllocColors();
     20 
     21  CTabHandle    GetCTab() {return mCTab;}
    2022protected:
    21   PIColorMapMac(CMapId id, int i);      // Fait une veritable allocation
    2223  void CopyFrom(PIColorMapGen*);
    2324 
    2425  CTabHandle    mCTab;
    2526  PaletteHandle mPalette;
     27
     28  friend class PIColorMapGen;
     29  friend class PIPixmapMac;
    2630};
    2731
  • trunk/SophyaPI/PI/picmapx.cc

    r63 r64  
    135135
    136136/* --Methode-- */
    137 int PIColorMapX::TotNbColors()
     137long PIColorMapX::TotNbColors()
    138138{
    139139if (NTotColors > 0)  return(NTotColors);
  • trunk/SophyaPI/PI/picmapx.h

    r63 r64  
    2020  virtual void FreeColors();
    2121
    22   virtual int TotNbColors();
     22  virtual long TotNbColors();
    2323  virtual int  NbAllocColors();
    2424
  • trunk/SophyaPI/PI/picontainermac.cc

    r15 r64  
    55: PIContainerGen(par, nom, sx, sy, px, py)
    66{
     7  // Par dŽfaut, un container est invisible.
     8  UnManage();
    79}
    810
     
    1012{}
    1113
    12 /* --Methode-- */
    13 void PIContainerMac::Show()
    14 {
    15   PIContainerGen::Show();
    16   mPane->Show();
    17   //((LWindow*)mPane)->Select();
    18 }
    19 
    20 /* --Methode-- */
    21 void PIContainerMac::Hide()
    22 {
    23   PIContainerGen::Hide();
    24   mPane->Hide();
    25 }
    26 
    27 
  • trunk/SophyaPI/PI/picontainermac.h

    r15 r64  
    1212  virtual                ~PIContainerMac();
    1313 
    14   virtual void           Show();
    15   virtual void           Hide();
    16 
    1714protected:
    1815
  • trunk/SophyaPI/PI/pifilechomac.cc

    r23 r64  
    33string PathNameFromDirID(long dirID, short vRefNum);
    44
     5string PIGetFileName(string dir);
     6string PIGetExistingFileName(string dir);
    57
    68string PIGetFileName(string dir)
     
    1113  string fName;
    1214  int i = dir.rfind(':');
    13   if (i == NPOS)
     15  if (i == string::npos)
    1416    fName = dir;
    1517  else if (i == dir.length())
     
    104106
    105107void
    106 PIFileChooserMac::SetPath(string const& path) {}
     108PIFileChooserMac::SetPath(string const& /*path*/) {}
    107109void
    108 PIFileChooserMac::SetFileName(string const& fname) {}
     110PIFileChooserMac::SetFileName(string const& /*fname*/) {}
    109111
    110112string
  • trunk/SophyaPI/PI/pimenubarmac.cc

    r34 r64  
    44PIMenubarMac::PIMenubarMac(PIApplicationGen* par, char* nom)
    55:PIMenubarGen(par, nom)
    6 {}
     6{
     7}
    78
    89PIMenubarMac::~PIMenubarMac()
  • trunk/SophyaPI/PI/pioptmenumac.cc

    r23 r64  
    77{
    88  delete mPane;
    9   LStr255 titre(Nom().c_str());
     9  //LStr255 titre(Nom().c_str());
     10  LStr255 titre("");
    1011 
    1112  StTextState textState;
     
    1516  int titleWidth = ::StringWidth(titre);
    1617 
    17   mPane = new LStdPopupMenu(mPaneInfo, msg_Click, 0, 200, titleWidth+5, popupMenuProc/*+popupVariableWidth*/, 0, titre, 0, 1);
     18  mPane = new LStdPopupMenu(mPaneInfo, msg_Click, 0, 200, titleWidth+5, popupMenuProc/*+popupVariableWidth*/, 130, titre, 0, 1);
    1819  //macMenu = ((LStdPopupMenu*)mPane)->GetMacMenuH();
    1920 
     
    2627 
    2728  ((LStdPopupMenu*)mPane)->AddListener(this);
     29  Manage();
    2830}
    2931
     
    7476if (n < 0)  return;
    7577 
     78StopListening();
    7679((LStdPopupMenu*)mPane)->SetValue(n+1);
     80StartListening();
    7781mStext = mPUMenu->GetMenuItemText(n);
    7882mSmsg  = msg;
  • trunk/SophyaPI/PI/pipixmapmac.cc

    r15 r64  
    3030void
    3131PIPixmapMac::Refresh()
     32{
     33        PIPixmapGen::Refresh();
     34}
     35
     36void
     37PIPixmapMac::DrawOff()
    3238{
    3339  if (mGWorld) {
     
    6571       
    6672        mPane->FocusDraw();
    67         SetPalette(mPane->GetMacPort(),cmap->mPalette, true);
    68         PIPixmapGen::Refresh();
     73//      SetPalette(mPane->GetMacPort(),cmap->mPalette, true);
     74//      PIPixmapGen::Refresh();
     75}
     76
     77void
     78PIPixmapMac::Draw(int,int,int,int)
     79{
     80  Draw();
    6981}
    7082
     
    7284PIPixmapMac::Draw()
    7385{
     86  DrawOff();
    7487  if (!mGWorld) return;
    7588  mPane->FocusDraw();
     
    8598                                &offsFrame, &paneFrame, srcCopy, nil);
    8699  ::UnlockPixels (mGWorld->portPixMap);
    87 
    88 
     100  DisposeGWorld(mGWorld);
     101  mGWorld = 0;
    89102}
  • trunk/SophyaPI/PI/pipixmapmac.h

    r15 r64  
    1313  virtual void  SetPixmap(unsigned char *pix, int sx, int sy, bool refr=true);
    1414  virtual void  Draw();
     15  virtual void  Draw(int x0, int y0, int dx, int dy);
    1516  virtual void  Refresh();
     17  virtual void  DrawOff();
    1618  virtual void  Resize();
    1719protected:
  • trunk/SophyaPI/PI/pippapplmac.cc

    r34 r64  
    22#include "piupdattachment.h"
    33#include "pippmenubar.h"
     4#include <LClipboard.h>
    45
    56PIPPApplMac::PIPPApplMac()
    67:LApplication()
    7 {}
     8{
     9  AddAttachment(new LClipboard);
     10}
    811
    912
  • trunk/SophyaPI/PI/pistdwdgmac.cc

    r34 r64  
    1212  delete mPane;
    1313  LStr255 titre(nom);
    14   mPane = new LCaption(mPaneInfo, titre, 0);
     14  mPane = new LCaption(mPaneInfo, titre, 130);
    1515}
    1616
     
    2828  delete mPane;
    2929  LStr255 titre(nom);
    30   mPane = new LStdButton(mPaneInfo, msg_Click, 0, titre);
     30  mPane = new LStdButton(mPaneInfo, msg_Click, 130, titre);
    3131  ((LStdButton*)mPane)->AddListener(this);
    3232}
     
    5252  delete mPane;
    5353  LStr255 titre(nom);
    54   mPane = new LEditField(mPaneInfo, titre, 0, 255, true, true, NULL, LCommander::GetTopCommander());
     54  mPane = new LEditField(mPaneInfo, titre, 130, 255, true, true, NULL, LCommander::GetTopCommander());
    5555}
    5656
     
    100100  LStr255 titre(nom);
    101101  mPane = new LStdControl(mPaneInfo, msg_Click, 1, 1, 10,
    102                                                   scrollBarProc, 0, titre, (Int32) this);
     102                                                  scrollBarProc, 130, titre, (Int32) this);
    103103  ((LStdControl*)mPane)->AddListener(this);
    104104 
     
    129129PIScaleMac::SetValue(int val)
    130130{
     131  StopListening();
    131132  ((LStdControl*)mPane)->SetValue(val);
     133  StartListening();
    132134}
    133135
     
    188190  delete mPane;
    189191  LStr255 titre(nom);
    190   mPane = new LStdCheckBox(mPaneInfo, msg_Click, 0, 0, titre);
     192  mPane = new LStdCheckBox(mPaneInfo, msg_Click, 0, 130, titre);
    191193  ((LStdCheckBox*)mPane)->AddListener(this);
    192194}
     
    205207PICheckBoxMac::SetState(bool st)
    206208{
     209  StopListening();
    207210  ((LStdCheckBox*)mPane)->SetValue(st ? 1 : 0);
     211  StartListening();
    208212}
    209213 
  • trunk/SophyaPI/PI/piwdgmac.cc

    r63 r64  
    1717:PIWdgGen(par, nom, sx, sy, px, py), mNom(nom)
    1818{
    19         mPaneInfo.paneID    = 'PIWD';
    20         mPaneInfo.width     = sx;
    21         mPaneInfo.height    = sy;
    22         mPaneInfo.visible   = true;
    23         mPaneInfo.enabled   = true;
    24         mPaneInfo.bindings.left =
    25                 mPaneInfo.bindings.top =
    26                 mPaneInfo.bindings.right =
    27                 mPaneInfo.bindings.bottom = false;
    28         mPaneInfo.left      = px;
    29         mPaneInfo.top       = py;
    30         mPaneInfo.userCon   = 'PIWD';
    31         mPaneInfo.superView = par ? (LView*) (((PIContainerMac*)(par))->mPane) : NULL;
     19  mAdapterPaneInfo.paneID    = 0;
     20  mAdapterPaneInfo.width     = sx;
     21  mAdapterPaneInfo.height    = sy;
     22  mAdapterPaneInfo.visible   = true;
     23  mAdapterPaneInfo.enabled   = true;
     24  mAdapterPaneInfo.bindings.left =
     25    mAdapterPaneInfo.bindings.top =
     26    mAdapterPaneInfo.bindings.right =
     27    mAdapterPaneInfo.bindings.bottom = false;
     28  mAdapterPaneInfo.left      = px;
     29  mAdapterPaneInfo.top       = py;
     30  mAdapterPaneInfo.userCon   = 0;
     31  mAdapterPaneInfo.superView = par ? (LView*) (((PIContainerMac*)(par))->mPane) : NULL;
     32
     33  mAdapterViewInfo.imageSize.width = sx;
     34  mAdapterViewInfo.imageSize.height = sy;
     35  mAdapterViewInfo.scrollPos.h =
     36    mAdapterViewInfo.scrollPos.v =
     37    mAdapterViewInfo.scrollUnit.h =
     38    mAdapterViewInfo.scrollUnit.v = 0;
     39  mAdapterViewInfo.reconcileOverhang = 0;
     40
     41  mAdapter = new PIPPViewAdapter(mAdapterPaneInfo, mAdapterViewInfo);
     42
     43  mPaneInfo.paneID    = 'PIWD';
     44  mPaneInfo.width     = sx;
     45  mPaneInfo.height    = sy;
     46  mPaneInfo.visible   = true;
     47  mPaneInfo.enabled   = true;
     48  mPaneInfo.bindings.left =
     49    mPaneInfo.bindings.top =
     50    mPaneInfo.bindings.right =
     51    mPaneInfo.bindings.bottom = true;
     52  mPaneInfo.left      = 0;
     53  mPaneInfo.top       = 0;
     54  mPaneInfo.userCon   = 'PIWD';
     55  mPaneInfo.superView = mAdapter;
    3256
    3357  mViewInfo.imageSize.width = sx;
     
    4064 
    4165  mPane = new LView(mPaneInfo, mViewInfo);
     66  ((LView*)mAdapter)->CalcPortOrigin();
    4267  ((LView*)mPane)->CalcPortOrigin();
    4368}
     
    4772{
    4873  delete mPane;
     74  delete mAdapter;
    4975}
    5076
     
    7197PIWdgMac::SetSize(int sx, int sy)
    7298{
     99  if (mAdapter)
     100   mAdapter->ResizeFrameTo(sx, sy, true);
     101  else
    73102   mPane->ResizeFrameTo(sx, sy, true);
    74103}
     
    77106PIWdgMac::SetPos(int px, int py)
    78107{
     108  if (mAdapter)
     109   mAdapter->MoveBy(px-XPos(), py-YPos(), false);
     110  else
    79111   mPane->MoveBy(px-XPos(), py-YPos(), false);
    80112}
     
    83115PIWdgMac::SetBinding(PIBindingKind left, PIBindingKind top,
    84116                     PIBindingKind right, PIBindingKind bottom)
    85 //  $CHECK$ Reza 13/10/96    Code a modifier
    86 {
    87   SBooleanRect r;
    88   r.left    = left;
    89   r.top     = top;
    90   r.right   = right;
    91   r.bottom  = bottom;
    92   mPane->SetFrameBinding(r);
     117{
     118  if (mAdapter) 
     119    mAdapter->SetBinding(left, top, right, bottom);
     120  //else
     121  //  mPane->SetBinding(left, top, right, bottom);
    93122}
    94123
     
    132161else return(false);
    133162}
     163
     164
     165// Gestion de Copier/Coller
     166#include <LClipboard.h>
     167/* --Methode-- */
     168// COPY
     169bool PIWdgMac::ClaimSelection()
     170{
     171  int l;
     172  char* txt = SelectionString(l);
     173  LClipboard::GetClipboard()->SetData('TEXT',txt,l,true);
     174  delete[] txt;
     175  return (true);
     176}
     177
     178/* --Methode-- */
     179void PIWdgMac::LoseSelection()
     180{
     181}
     182
     183/* --Methode-- */
     184// PASTE
     185void PIWdgMac::RequestSelection()
     186{
     187  Handle h = NewHandle(0);
     188  Int32 l = LClipboard::GetClipboard()->GetData('TEXT', h);
     189  if (l) {
     190    CopyFromSelection(*h, l);
     191  }
     192}
     193
     194/* --Methode-- */
     195void PIWdgMac::CopyFromSelection(char * sv, int l)
     196{
     197char* buff = new char[l+2];
     198strncpy(buff, sv, l);
     199buff[l] = '\0';
     200printf("PIWdgMac::RequestSelection() L=%d [%s] \n", l, buff);
     201delete buff;
     202return;
     203}
     204
     205/* --Methode-- */
     206char* PIWdgMac::SelectionString(int& len)
     207{
     208char *rs = new char[60];
     209strcpy(rs, "Test-of-PIWdgMac::SelectionString()");
     210len = strlen(rs);
     211return(rs);
     212}
     213
     214
     215/* --Methode-- */
     216void PIWdgMac::Manage()
     217{
     218  if (mAdapter) mAdapter->Show();
     219  mPane->Show();
     220}
     221
     222/* --Methode-- */
     223void PIWdgMac::UnManage()
     224{
     225  mPane->Hide();
     226  if (mAdapter) mAdapter->Hide();
     227}
     228
     229/* --Methode-- */
     230bool PIWdgMac::IfManaged()
     231{
     232  return(mPane->IsVisible());
     233}
  • trunk/SophyaPI/PI/piwdgmac.h

    r63 r64  
    33
    44#include "piwdggen.h"
     5#include "pippviewadapter.h"
    56#include <LPane.h>
    67#include <LListener.h>
     
    3233  virtual bool           IfManaged();
    3334  virtual bool           IsVisible();
     35 
     36//  Gestion de copier-coller
     37  virtual bool           ClaimSelection();
     38  virtual void           LoseSelection();
     39  virtual void           RequestSelection();
     40  virtual void           CopyFromSelection(char *, int l);
     41  virtual char*          SelectionString(int& len);
    3442
    3543protected:
    3644  LPane*                                 mPane;
     45  PIPPViewAdapter*       mAdapter;
     46  SPaneInfo                              mAdapterPaneInfo;
     47  SViewInfo                              mAdapterViewInfo;
    3748  SPaneInfo                              mPaneInfo;
    3849  SViewInfo                              mViewInfo;
  • trunk/SophyaPI/PI/piwindowmac.cc

    r9 r64  
    55{
    66        delete mPane;
     7        delete mAdapter;
     8        mAdapter = NULL;
    79        mWindowInfo.WINDid = 1000+k;
    810        mWindowInfo.attributes = windAttr_EraseOnUpdate |
     
    3638        mWindowInfo.userCon = 0;
    3739       
    38         mPane = new LWindow(mWindowInfo);
     40        //mPane = new LWindow(mWindowInfo);
     41        mPane = LWindow::CreateWindow(1000+k,LCommander::GetTopCommander());
    3942        Rect r = {py, px, py+sy, px+sx};
    4043    ((LWindow*) mPane)->DoSetBounds(r);
    4144    SetLabel(nom);
    42     ((LWindow*) mPane)->SetSuperCommander(LCommander::GetTopCommander());
     45    //((LWindow*) mPane)->SetSuperCommander(LCommander::GetTopCommander());
    4346}
    4447
     
    5659  PIWindowGen::Show();
    5760}
     61
     62void
     63PIWindowMac::SetSize(int sx, int sy)
     64{
     65   ((LWindow*) mPane)->ResizeWindowTo(sx, sy);
     66}
     67
     68void
     69PIWindowMac::SetPos(int px, int py)
     70{
     71   ((LWindow*) mPane)->MoveWindowTo(px-XPos(), py-YPos());
     72}
  • trunk/SophyaPI/PI/piwindowmac.h

    r2 r64  
    1212  virtual                ~PIWindowMac();
    1313  virtual void           Show();
     14  virtual void           SetSize(int sx, int sy);
     15  virtual void           SetPos(int px, int py);
    1416
    1517protected:
Note: See TracChangeset for help on using the changeset viewer.