Changeset 60 in Sophya


Ignore:
Timestamp:
Nov 5, 1997, 6:41:33 PM (28 years ago)
Author:
ansari
Message:

Correction Pb PIContainerX , XmForm (Voir aussi PIWdgX)
Ajouts definition de touches clavier ds pibwdgge.h et suppression des
fonctions ActivateMove() ... pour PIBaseWdgGen et Mac -
Petite modifs pour PIMenuX pour aviter conflit avec certains WindMgr

Reza 5/11/97

Location:
trunk/SophyaPI/PI
Files:
16 edited

Legend:

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

    r11 r60  
    1717str[20] = '\0';
    1818
    19 ActivateKeyboard();
    20 ActivateButton(1);
    21 ActivateButton(2);
    22 ActivateButton(3);
    2319}
    2420
     
    148144buf[0] = key;  buf[1] = '\0';
    149145
     146printf("ExBWdg::Keyboard: Key= %d (%c) , Mod= %d \n", key, (char)key, (int)kmod);
    150147SelFont(PI_BigSizeFont, PI_BoldFont);
    151148DrawString(20, 75, buf);
  • trunk/SophyaPI/PI/piapplx.cc

    r52 r60  
    99static Cursor a_curs[3];
    1010static bool a_fgcur=false;
     11
     12//  Voir fichier pimenux.cc , Pour resoudre certains conflits avec les WindowManagers
     13void SetTopWdgForMenuX(SysDWdg mtw);
    1114
    1215/* --Methode-- */
     
    2427intcont = new PIContainerX((PIMsgHandler *)this, topwdg, "MBCont",
    2528                            10, 10, 0, 0);
     29// Pb avec les Popup MenuX et certains Window Manager , voir pimenux.cc
     30SetTopWdgForMenuX(intcont->XtWdg());
     31
    2632menubar = new PIMenubar(this, "DefMenubar");
    2733Menubar()->SetBinding(PIBK_fixed, PIBK_fixed, PIBK_fixed, PIBK_free);
  • trunk/SophyaPI/PI/pibwdggen.h

    r52 r60  
    1010#include <list>   
    1111
     12enum PIKeyModifier { PIKM_Blank = 0, PIKM_Shift = 1, PIKM_Alt = 2, PIKM_Cntl = 4 } ;
    1213
    13 enum PIKeyModifier { PIKM_Blank = 0, PIKM_Shift = 1, PIKM_Alt = 2, PIKM_Cntl = 4 } ;
     14enum PIKeyValues { PIK_Return = 1+0x2000, PIK_Enter = 2+0x2000 ,
     15                   PIK_BackSpace = 3+0x2000, PIK_Delete = 4+0x2000,
     16                   PIK_Tab = 5+0x2000, PIK_Escape = 6+0x2000,
     17                   PIK_Up = 11+0x2000, PIK_Down = 12+0x2000,
     18                   PIK_Right = 13+0x2000, PIK_Left = 14+0x2000,
     19                   PIK_Previous = 21+0x2000, PIK_Next = 22+0x2000  } ;
    1420
    1521enum PIColors  { PI_NotDefColor = -1,
     
    5662
    5763  virtual long       kind() {return ClassId; }
    58 
    59 //  Activation des evenements   
    60   virtual void       ActivatePtrCross()        = 0;
    61   virtual void       ActivateButton(int bid)   = 0;
    62   virtual void       ActivateMove(int bid)     = 0;
    63   virtual void       ActivateKeyboard()        = 0;
    6464
    6565//  Trace graphiques
  • trunk/SophyaPI/PI/pibwdgmac.cc

    r52 r60  
    2424}
    2525
    26 
    27 /* --Methode-- */
    28 void PIBaseWdgMac::ActivatePtrCross()
    29 {
    30 // toujours actif pour le moment
    31 }
    32 
    33 
    34 /* --Methode-- */
    35 void PIBaseWdgMac::ActivateButton(int /*bid*/)
    36 {
    37 }
    38 
    39 /* --Methode-- */
    40 void PIBaseWdgMac::ActivateMove(int /*bid*/)
    41 {
    42 }
    43 
    44 
    45 /* --Methode-- */
    46 void PIBaseWdgMac::ActivateKeyboard()
    47 {
    48 }
    4926
    5027/* --Methode-- */
  • trunk/SophyaPI/PI/pibwdgmac.h

    r52 r60  
    1717                                   int sx=10, int sy=10, int px=0, int py=0);
    1818  virtual           ~PIBaseWdgMac();
    19 
    20 //  Activation des evenements   
    21   virtual void       ActivatePtrCross();
    22   virtual void       ActivateButton(int bid);
    23   virtual void       ActivateMove(int bid);
    24   virtual void       ActivateKeyboard();
    2519
    2620//  Trace graphiques
  • trunk/SophyaPI/PI/pibwdgx.cc

    r52 r60  
    4848XtSetArg(wargs[2],XtNborderWidth, (Dimension)0); 
    4949XtSetValues(XtWdg(), wargs, 3);
     50
     51XtUninstallTranslations(XtWdg());
    5052
    5153mDefGC = XCreateGC (PIXDisplay(), XtWindow(PIXtTopWdg()), 0, NULL);
     
    6365SelMarker(1, PI_DotMarker);
    6466
     67// On active tous les evenements ...
     68ActivatePtrCross();
     69ActivateKeyboard();
     70int i;
     71for(i=1; i<=3; i++) {
     72  ActivateButton(i);
     73  ActivateMove(i);
     74}
    6575Manage();
    6676}
  • trunk/SophyaPI/PI/pibwdgx.h

    r52 r60  
    1717
    1818  virtual void    FinishCreate(); // appele par la fenetre mere, apres XtRealize()
    19 
    20 //  Activation des evenements   
    21   virtual void   ActivatePtrCross();
    22   virtual void   ActivateButton(int bid);
    23   virtual void   ActivateMove(int bid);
    24   virtual void   ActivateKeyboard();
    2519
    2620//  Trace graphiques
     
    9892  void           Init();
    9993  void           SelectFont(int isz, int jat);
     94//  Activation des evenements   
     95  void   ActivatePtrCross();
     96  void   ActivateButton(int bid);
     97  void   ActivateMove(int bid);
     98  void   ActivateKeyboard();
    10099
    101100  GC mDefGC;
  • trunk/SophyaPI/PI/picontainerx.cc

    r52 r60  
    88: PIContainerGen(par, nom, sx, sy, px, py)
    99{
    10 if ((sx > 0) && (sy > 0))
     10if ((sx > 0) && (sy > 0)) 
    1111  CreateXtWdg(nom, xmFormWidgetClass , NULL, sx, sy, px, py);
    1212//  CreateXtWdg(nom, xmBulletinBoardWidgetClass , NULL, sx, sy, px, py);
     
    1818{
    1919SetMsgParent(par);
    20 if ((sx > 0) && (sy > 0))
     20if ((sx > 0) && (sy > 0)) 
    2121  CreateXtWdg(nom, xmFormWidgetClass , parwdg->XtWdg(), sx, sy, px, py);
    2222}
  • trunk/SophyaPI/PI/piimage.cc

    r59 r60  
    5252SelForeground(PI_White);
    5353SelBackground(PI_Black);
    54 
    55 ActivateButton(1);
    56 ActivateMove(1);
    57 ActivateButton(2);
    58 ActivateMove(2);
    59 ActivateButton(3);
    60 ActivateMove(3);
    6154
    6255}
  • trunk/SophyaPI/PI/pimenux.cc

    r56 r60  
    1111/************* PIMenuX ************/
    1212
     13// Quand on cree les menus comme fils du Top-Widget, ca rentre en
     14// conflit avec certaains Window-Manager ...
     15// La fonction suivante permet de bypasser ce probleme- Le createur d'application
     16// X doit donc appeler la fonction ci-dessous pour initialiser menuXTopWdg
     17//                                               Reza /411/97
     18static SysDWdg menuXTopWdg = NULL;
     19void SetTopWdgForMenuX(SysDWdg mtw) {
     20  menuXTopWdg = mtw;
     21}
     22
    1323// Pour ces sal... de XmString  (ds piwdgx.cc)
    1424int CStrFrXmStr(XmString xms, char* buff, int nmx);
     25
    1526
    1627// Fonction prive (CallBack)
     
    4354mBut = new _pimxit_[mNItemMax];
    4455
     56SysDWdg tw= menuXTopWdg;
     57if (tw == NULL) tw = PIXtTopWdg();
     58
    4559if (pdpu == k_PopupMenu)
    46   XtWdg() = XmCreatePopupMenu( PIXtTopWdg(), nom, NULL, 0);
     60  XtWdg() = XmCreatePopupMenu( tw, nom, NULL, 0);
    4761else
    48   XtWdg() = XmCreatePulldownMenu( PIXtTopWdg(), nom, NULL, 0);
     62  XtWdg() = XmCreatePulldownMenu( tw, nom, NULL, 0);
    4963
    5064wmis = k_wmi_normal ;
  • trunk/SophyaPI/PI/pipixmapgen.cc

    r49 r60  
    2222cmap = new PIColorMap(CMAP_GREY32);
    2323mEn = 0;
    24 ActivateButton(1);
    2524}
    2625
  • trunk/SophyaPI/PI/piscdrawwdg.cc

    r54 r60  
    1818  mTrW = NULL;
    1919  SetTextWin(NULL);
    20 
    21   ActivateButton(1);    // Pour pouvoir activer la fenetre et coordonnees
    22   ActivateMove(1);      //    "         "         "        "
    23   ActivateButton(2);
    24   ActivateMove(2);
    2520
    2621}
  • trunk/SophyaPI/PI/pitestapp.cc

    r23 r60  
    2020#include "piimage.h"
    2121
     22#include PILIST_H
     23
    2224#include "fitsimage.h"
     25
     26#include <X11/Xlib.h>
    2327
    2428int SysBeep(int n)
     
    9599: PIApplication(sx, sy)
    96100{
     101char ans[128];
    97102//   menb = new PIMenubar(this, "MyMenubar");
    98103   m[0] = new PIPDMenu((PIMsgHandler *)Menubar(),"File");
     
    100105   m[0]->AppendItem("Close", 10102);
    101106   m[0]->AppendItem("New", 10103);
     107   m[0]->AppendItem("ScBar", 10105);
    102108   m[0]->AppendItem("Quit", 10104);
    103109   m[1] = new PIPDMenu((PIMsgHandler *)Menubar(),"Edit");
     
    124130  bouton4 = new PIButton(this->MainWin(), "Dialog", 333, 40, 25, 200, 120);
    125131  bouton5 = new PIButton(this->MainWin(), "ScDraw", 433, 40, 25, 260, 120);
    126   scl = new PIScale(this->MainWin(), "Scale", 88, 5, 45, 100, 20, 10, 150);
    127 
     132  scl = new PIScale(this->MainWin(), "Scale", 88, true, 100, 20, 10, 150);
     133  scl->SetMinMax(5, 45);
    128134  zoom = new PIPixmap(this->MainWin(), "Zoom", 100,100,5,195);
    129135  labimg = new PILabel(this->MainWin(), "PixelValue", 250, 20, 10, 320);
    130136
    131   menu = new PIPUMenu((PIMsgHandler *)this, "myMenu");
     137//  XSync(PIXDisplay(), FALSE);
     138//  printf("Creation PIPUMenu DoIt-1... \n");   gets(ans);
     139  menu = new PIPUMenu((PIMsgHandler *)this->MainWin(), "myMenu");
     140//  XSync(PIXDisplay(), FALSE);
     141//  printf("Apres Creation PIPUMenu -AppendItem() 1 ... \n");   gets(ans);
     142
    132143  menu->AppendItem("DoIt-1", 4401);
     144//  XSync(PIXDisplay(), FALSE);
     145//  printf("Apres Creation PIPUMenu -AppendItem() 2 ... \n");   gets(ans);
     146
    133147  menu->AppendItem("DoIt-2", 4402);
    134148  menu->AppendItem("DoIt-25", 4425);
     
    137151  menu->AppendItem("Check-33", 4433);
    138152
    139   pum[1] = new PIPUMenu((PIMsgHandler *)this,"Edit");
     153//  XSync(PIXDisplay(), FALSE);
     154//  printf("Creation PIPUMenu Copier ... \n");   gets(ans);
     155  pum[1] = new PIPUMenu((PIMsgHandler *)this->MainWin(),"Edit");
    140156  pum[1]->AppendItem("Copier", 80201);
    141157  pum[1]->AppendItem("Coller", 80202);
     
    144160  pum[1]->AppendItem("Select-All", 80205);
    145161
    146   pum[0] = new PIPUMenu((PIMsgHandler *)this, "myMenu");
     162  pum[0] = new PIPUMenu((PIMsgHandler *)this->MainWin(), "myMenu");
    147163  pum[0]->AppendItem("Linear", 5601);
    148164  pum[0]->AppendItem("Log.", 5602);
     
    151167  pum[0]->AppendItem("Polyn", 5605);
    152168
     169
    153170  opt = new PIOptMenu(this->MainWin(), pum[0], 90, 25, 110, 150);
    154171  opt->SetValueStr("Sqrt");
     
    157174  opt3 = new PIOptMenu(this->MainWin(), pum[0], 80, 25, 110, 250);
    158175  opt3->SetValueStr("Linear");
    159 
     176 
    160177}
    161178
     
    188205static PIImage *cur=NULL;
    189206static ScSample *scs1, *scs2, *scs3;
     207static PIScrollBar *scb, *scb2;
    190208static ExBWdg *exb1;
    191209
    192 static PIWindow * wp3, *wp2, *wp4, *wp5;
     210static PIWindow * wp3, *wp2, *wp4, *wp5, *wp6;
    193211static PIPixmap * pxm;
    194212static unsigned char  pixels[25000];
     
    198216static bool  fgt2 = false;
    199217
     218static PIListX * pil;
     219
    200220void
    201221PITestApp::Process(PIMessage msg, PIMsgHandler* sender, void* data)
     
    208228  sprintf(truc,"< %ld - %d (%d)>",msg,x++, (int)((PIWdgGen *)sender)->kind());
    209229  this->label->SetLabel(truc);
    210   sprintf(truc,"[%d] Msg= %ld (%d-%d) Kind=(%d)",x, msg, (int)UserMsg(msg),
    211          (int)ModMsg(msg), (int)((PIWdgGen *)sender)->kind());
     230  sprintf(truc,"[%d] Msg= %ld (%d-%d) Kind=(%d)  Data= (%d - %lx)",x, msg, (int)UserMsg(msg),
     231         (int)ModMsg(msg), (int)((PIWdgGen *)sender)->kind(), (int)data, (long)data);
    212232  puts(truc);
    213233
     
    252272  if (msg == 433)
    253273    {
    254     if (fgt2) { wp5->Hide();  fgt2 = false; }
    255     else { wp5->Show();  fgt2 = true; }
     274    if (fgt2) { wp5->Hide();  wp6->Hide(); fgt2 = false; }
     275    else { wp5->Show();  wp6->Show(); fgt2 = true; }
    256276    }
    257277
    258278//  if (msg == 555)   (this->menu)->Show();
    259279
     280  if (msg == 10105)  scb->SetSize(atoi(((char *)text->GetText().c_str())));
    260281  if (msg == 10104)  Stop();
    261282  if (msg == 10101)  { pfc->AcceptNewFile(false); pfc->Show(); }
     
    265286   {
    266287   numsg++;   
    267    m[1]->AppendItem((char *)text->GetText().c_str(), numsg);
     288   string nit;
     289   nit = text->GetText();
     290   m[1]->AppendItem((char *)nit.c_str(), numsg);
    268291   opt2->SetValue(numsg);
    269292   }
     
    272295  if (msg == 10303) 
    273296    {
    274     long ml =  atol(text->GetText().c_str());
     297    string nit;
     298    nit = text->GetText();
     299    long ml =  atol(nit.c_str());
    275300    m[1]->DeleteItemMsg(ml);
    276301    opt2->SetValue(10201);
     
    278303
    279304
    280   if ((msg > 8000) && data) printf("PITestApp::MenubarReturn: %s \n", (char *)data);
     305  if ((msg > 9000) && data) printf("PITestApp::MenubarReturn: %s \n", (char *)data);
    281306  if (msg == 5000) 
    282307    {
     
    306331}
    307332
    308 int main()
    309 {
     333int main(int narg, char *arg[])
     334{
     335  int mii;
     336
    310337  PITestApp * app;
    311338  app = new PITestApp(350, 350);
    312339
    313   wp2 = new PIWindow(app, "Window-2", PIWK_normal,  150, 150, 250, 250);
    314   ExBWdg bw(wp2, "BWdg", 150, 150, 0, 0);
    315 //  bw.ActivateButton(1);
    316 //  bw.ActivatePtrCross();
    317 //  bw.ActivateKeyboard();
    318 
     340  wp2 = new PIWindow(app, "Window-2", PIWK_normal,  200, 200, 250, 250);
     341  ExBWdg bw(wp2, "BWdg", 150, 150, 10, 40);
     342  bw.SetBinding(PIBK_fixed,PIBK_elastic,PIBK_elastic,PIBK_fixed);
    319343
    320344  wp4 = new PIWindow(app, "Window-4", PIWK_dialog,  200, 200, 350, 350);
     
    340364  pxm->SetPixmap(pixels, 150, 150);
    341365
    342   wp5 = new PIWindow(app, "Window-5", PIWK_normal,  400, 450, 200, 200);
     366  wp5 = new PIWindow(app, "Window-5", PIWK_normal,  420, 450, 200, 200);
    343367  scs1 = new ScSample(wp5, "ScSample", 200, 200, 0, 0);
    344368  scs1->SetBinding(PIBK_elastic,PIBK_elastic,PIBK_elastic,PIBK_elastic);
    345369  scs2 = new ScSample(wp5, "ScSample", 160, 160, 220, 20);
    346   scs2->SetBinding(PIBK_elastic,PIBK_fixed,PIBK_fixed,PIBK_elastic);
     370  printf("DBG-WP5 (A) , SCS2, SzC %d %d , Sz %d %d Pos %d %d \n", wp5->XSize(),
     371         wp5->YSize(), scs2->XSize(), scs2->YSize(),scs2->XPos(), scs2->YPos() );
     372//  scs2->SetBinding(PIBK_elastic,PIBK_fixed,PIBK_fixed,PIBK_elastic);
     373  scs2->SetBinding(PIBK_elastic,PIBK_elastic,PIBK_elastic,PIBK_elastic);
     374  printf("DBG-WP5 (B) , SCS2, SzC %d %d , Sz %d %d Pos %d %d \n", wp5->XSize(),
     375         wp5->YSize(), scs2->XSize(), scs2->YSize(),scs2->XPos(), scs2->YPos() );
     376
     377  scb = new PIScrollBar(wp5, "ScBar", 8811, true, 15, 420, 405, 0);
     378  scb->SetBinding(PIBK_free,PIBK_fixed,PIBK_fixed,PIBK_fixed);
     379  scb->ActivateDrag(true);
     380  scb2 = new PIScrollBar(wp5, "ScBar", 8821, false, 420, 15, 0, 425);
     381  scb2->SetBinding(PIBK_fixed,PIBK_free,PIBK_fixed,PIBK_fixed);
    347382
    348383  scs3 = new ScSample(wp5, "ScSample", 200, 200, 100, 220);
    349 
    350384  scs3->SetBinding(PIBK_elastic,PIBK_elastic,PIBK_elastic,PIBK_elastic);
    351385  /* 
     
    358392  pfc->SetPath("/exp/eros/ImagRed/");
    359393
    360 
     394  wp6 = new PIWindow(app, "Window-List", PIWK_normal,  200, 250, 300, 400);
     395  pil = new PIListX(wp6, "MyList", 200, 250, 0, 0);
     396  pil->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed,PIBK_fixed);
     397  for(mii=1; mii<narg; mii++)
     398    {
     399    printf("AppendItem[%d] - %s (%ld) \n", mii, arg[mii],  3330+mii); 
     400     pil->AppendItem(arg[mii], 3330+mii); 
     401    puts("Append-OK");
     402    }
     403  pil->SetMultipleSelect(true);
     404  pil->SelectItem("user.cc");
    361405//  Int32 ioNumber = 100;
    362406  app->Run();
  • trunk/SophyaPI/PI/piup.h

    r37 r60  
    11#include "cimage.h"
    2 
     2extern "C" {
    33RzImage * PIUserProc_1(ImageR4& myimg, int xp, int yp, int dx, int dy,
    44                       char * arg1, char * arg2);
     
    77RzImage * PIUserProc_3(ImageR4& myimg, int xp, int yp, int dx, int dy,
    88                       char * arg1, char * arg2);
     9}
     10
  • trunk/SophyaPI/PI/piwdgx.cc

    r56 r60  
    244244                        PIBindingKind right, PIBindingKind bottom)
    245245{
    246 Arg  wargs[3];
     246Arg  wargs[9];
    247247int n=0;
    248248if (!sdw)  return;
    249249if (!parent)  return;
    250250
    251 /*
     251int fbase = 1000 ;  // Valeur de XmNfractionBase des XmForm ds PIContainerX
     252int frpos = 0;
     253float frac;
     254
    252255n = 0;
    253 XtSetArg(wargs[n],XmNfractionBase, 500);  n++;
    254 XtSetValues(this->sdw, wargs, n);
    255 */
     256XtSetArg(wargs[n],XmNfractionBase, fbase);  n++;
     257XtSetValues(parent->XtWdg(), wargs, n);
     258
     259// printf(" DEBUG_SetBinding: C-Sz= %d %d - Sz=%d %d , Pos= %d %d \n",  parent->XSize(),
     260// parent->YSize(), XSize(), YSize(), XPos(), YPos());
    256261switch (left)
    257262  {
    258263  case PIBK_free :
    259     n = 0;
    260264    XtSetArg(wargs[n],XmNleftAttachment, XmATTACH_NONE);  n++;
    261     XtSetValues(this->sdw, wargs, n);
    262265    break;
    263266  case PIBK_fixed :
    264     n = 0;
    265267    XtSetArg(wargs[n],XmNleftAttachment, XmATTACH_FORM);  n++;
    266268    XtSetArg(wargs[n],XmNleftOffset, XPos() );  n++;
    267     XtSetValues(this->sdw, wargs, n);
    268269    break;
    269270  case PIBK_elastic :
    270     n = 0;
    271271    XtSetArg(wargs[n],XmNleftAttachment, XmATTACH_POSITION);  n++;
    272     XtSetArg(wargs[n],XmNleftPosition, (XPos()*100/parent->XSize()) );  n++;
    273     XtSetValues(this->sdw, wargs, n);
     272    frac = (float)(XPos())/(float)parent->XSize() ;
     273    frpos = frac*fbase;
     274    XtSetArg(wargs[n],XmNleftPosition, frpos );  n++;
    274275    break;
    275276  }
     
    278279  {
    279280  case PIBK_free :
    280     n = 0;
    281281    XtSetArg(wargs[n],XmNtopAttachment, XmATTACH_NONE);  n++;
    282     XtSetValues(this->sdw, wargs, n);
    283282    break;
    284283  case PIBK_fixed :
    285     n = 0;
    286284    XtSetArg(wargs[n],XmNtopAttachment, XmATTACH_FORM);  n++;
    287285    XtSetArg(wargs[n],XmNtopOffset, YPos() );  n++;
    288     XtSetValues(this->sdw, wargs, n);
    289286    break;
    290287  case PIBK_elastic :
    291     n = 0;
    292288    XtSetArg(wargs[n],XmNtopAttachment, XmATTACH_POSITION);  n++;
    293     XtSetArg(wargs[n],XmNtopPosition, (YPos()*100/parent->YSize()) );  n++;
    294     XtSetValues(this->sdw, wargs, n);
     289    frac = (float)(YPos())/(float)parent->YSize() ;
     290    frpos = frac*fbase;
     291    XtSetArg(wargs[n],XmNtopPosition, frpos );  n++;
    295292    break;
    296293  }
     
    299296  {
    300297  case PIBK_free :
    301     n = 0;
    302298    XtSetArg(wargs[n],XmNrightAttachment, XmATTACH_NONE);  n++;
    303     XtSetValues(this->sdw, wargs, n);
    304299    break;
    305300  case PIBK_fixed :
    306     n = 0;
    307301    XtSetArg(wargs[n],XmNrightAttachment, XmATTACH_FORM);  n++;
    308302    XtSetArg(wargs[n],XmNrightOffset, parent->XSize()-(XSize()+XPos()) );  n++;
    309     XtSetValues(this->sdw, wargs, n);
    310303    break;
    311304  case PIBK_elastic :
    312     n = 0;
    313305    XtSetArg(wargs[n],XmNrightAttachment, XmATTACH_POSITION);  n++;
    314     XtSetArg(wargs[n],XmNrightPosition, ((XPos()+XSize())*100/parent->XSize()) );  n++;
    315     XtSetValues(this->sdw, wargs, n);
     306    frac = (float)(XPos()+XSize())/(float)parent->XSize() ;
     307    frpos = frac*fbase;
     308    XtSetArg(wargs[n],XmNrightPosition, frpos );  n++;
    316309    break;
    317310  }
     
    320313  {
    321314  case PIBK_free :
    322     n = 0;
    323315    XtSetArg(wargs[n],XmNbottomAttachment, XmATTACH_NONE);  n++;
    324     XtSetValues(this->sdw, wargs, n);
    325316    break;
    326317  case PIBK_fixed :
    327     n = 0;
    328318    XtSetArg(wargs[n],XmNbottomAttachment, XmATTACH_FORM);  n++;
    329319    XtSetArg(wargs[n],XmNbottomOffset, parent->YSize()-(YSize()+YPos()) );  n++;
    330     XtSetValues(this->sdw, wargs, n);
    331320    break;
    332321  case PIBK_elastic :
    333     n = 0;
    334322    XtSetArg(wargs[n],XmNbottomAttachment, XmATTACH_POSITION);  n++;
    335     XtSetArg(wargs[n],XmNbottomPosition, ((YPos()+YSize())*100/parent->YSize()) );  n++;
    336     XtSetValues(this->sdw, wargs, n);
    337     break;
    338   }
     323    frac = (float)(YPos()+YSize())/(float)parent->YSize() ;
     324    frpos = frac*fbase;
     325    XtSetArg(wargs[n],XmNbottomPosition, frpos );  n++;
     326    break;
     327  }
     328
     329XtSetValues(this->sdw, wargs, n);
     330
     331// printf(" Out_SetBinding: C-Sz= %d %d - Sz=%d %d , Pos= %d %d \n",  parent->XSize(),
     332// parent->YSize(), XSize(), YSize(), XPos(), YPos());
    339333
    340334return;
  • trunk/SophyaPI/PI/pixtbase.cc

    r52 r60  
    66#include <X11/IntrinsicP.h>
    77#include <X11/CoreP.h>
     8
     9#include <X11/keysym.h>
    810
    911#include "pixtbaseP.h"
     
    356358last_time_xevt = evt->xkey.time;
    357359last_serial_xevt = evt->xkey.serial;
     360
    358361if (((PIXtBaseWidget)wdgp)->pixtbase.objet) 
    359362  {
     
    361364  KeySym key;
    362365  char buf[10];
    363   int i,nc;
     366  int i,nc,rkey;
    364367  PIKeyModifier kmod;
    365368 
    366369  kmod = PIKM_Blank;
    367 
    368370  nc = XLookupString(&(evt->xkey), buf, 10, &key, &cs);
    369   if (nc <= 0)  return;
     371
    370372  if  (evt->xkey.state & ShiftMask)   
    371373    kmod = (PIKeyModifier) (kmod | PIKM_Shift);
    372374  if  (evt->xkey.state & ControlMask)
    373375    kmod = (PIKeyModifier) (kmod | PIKM_Cntl);
    374   if  (evt->xkey.state & Mod2Mask)   
     376  if  (evt->xkey.state & Mod1Mask)   
    375377    kmod = (PIKeyModifier) (kmod | PIKM_Alt);
    376   for(i=0; i<nc; i++) 
     378  switch (key) {
     379    case XK_Return :
     380      rkey = PIK_Return;
     381      break;
     382    case XK_KP_Enter :
     383      rkey = PIK_Enter;
     384      break;
     385    case XK_Up :
     386      rkey = PIK_Up;
     387      break;
     388    case XK_Down :
     389      rkey = PIK_Down;
     390      break;
     391    case XK_Left :
     392      rkey = PIK_Left;
     393      break;
     394    case XK_Right :
     395      rkey = PIK_Right;
     396      break;
     397    case XK_Prior :
     398      rkey = PIK_Previous;
     399      break;
     400    case XK_Next :
     401      rkey = PIK_Next;
     402      break;
     403    default :
     404      rkey = 0;
     405      break;
     406  }
     407  if (rkey > 0)  (((PIXtBaseWidget)wdgp)->pixtbase.objet)->Keyboard(rkey, kmod);
     408  else for(i=0; i<nc; i++) 
    377409    (((PIXtBaseWidget)wdgp)->pixtbase.objet)->Keyboard((int)(buf[i]), kmod);
    378   }
     410}
    379411return;
    380412}
Note: See TracChangeset for help on using the changeset viewer.