Changeset 4086 in Sophya


Ignore:
Timestamp:
May 29, 2013, 3:12:57 PM (11 years ago)
Author:
garnier
Message:

before moving eventFilter

Location:
trunk/SophyaPI/PI
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PI/Quartz/QuartzAppTest.cpp

    r4085 r4086  
    124124    vector<int> points;
    125125
    126     printf("main debut\n");
     126    printf("main debut---\n");
    127127
    128128    mainApp = new QuartzApp();
  • trunk/SophyaPI/PI/Quartz/Test/Quartz2DBasics/Quartz2DBasics.carbon/Info.plist

    r4084 r4086  
    11<?xml version="1.0" encoding="UTF-8"?>
    2 <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
     2<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    33<plist version="1.0">
    44<dict>
  • trunk/SophyaPI/PI/Quartz/Test/Quartz2DBasics/Quartz2DBasics.cocoa/Quartz2DBasics.cocoa.xcodeproj/project.pbxproj

    r4084 r4086  
    44        classes = {
    55        };
    6         objectVersion = 42;
     6        objectVersion = 46;
    77        objects = {
    88
     
    1717                8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
    1818/* End PBXBuildFile section */
    19 
    20 /* Begin PBXBuildStyle section */
    21                 2D00B68C0A4856F8006A99DB /* Development */ = {
    22                         isa = PBXBuildStyle;
    23                         buildSettings = {
    24                                 COPY_PHASE_STRIP = NO;
    25                         };
    26                         name = Development;
    27                 };
    28                 2D00B68D0A4856F8006A99DB /* Deployment */ = {
    29                         isa = PBXBuildStyle;
    30                         buildSettings = {
    31                                 COPY_PHASE_STRIP = YES;
    32                         };
    33                         name = Deployment;
    34                 };
    35 /* End PBXBuildStyle section */
    3619
    3720/* Begin PBXFileReference section */
     
    162145                29B97313FDCFA39411CA2CEA /* Project object */ = {
    163146                        isa = PBXProject;
     147                        attributes = {
     148                                LastUpgradeCheck = 0460;
     149                        };
    164150                        buildConfigurationList = 2D4F4E8A08E0C8B9002C8F59 /* Build configuration list for PBXProject "Quartz2DBasics.cocoa" */;
    165                         buildSettings = {
    166                         };
    167                         buildStyles = (
    168                                 2D00B68C0A4856F8006A99DB /* Development */,
    169                                 2D00B68D0A4856F8006A99DB /* Deployment */,
    170                         );
     151                        compatibilityVersion = "Xcode 3.2";
     152                        developmentRegion = English;
    171153                        hasScannedForEncodings = 1;
     154                        knownRegions = (
     155                                en,
     156                        );
    172157                        mainGroup = 29B97314FDCFA39411CA2CEA /* BasicDrawing.cocoa */;
    173158                        projectDirPath = "";
     159                        projectRoot = "";
    174160                        targets = (
    175161                                8D1107260486CEB800E47090 /* Quartz2DBasics.Cocoa */,
     
    228214                        isa = XCBuildConfiguration;
    229215                        buildSettings = {
     216                                COMBINE_HIDPI_IMAGES = YES;
    230217                                COPY_PHASE_STRIP = NO;
    231218                                GCC_DYNAMIC_NO_PIC = NO;
    232                                 GCC_ENABLE_FIX_AND_CONTINUE = YES;
    233219                                GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
    234220                                GCC_OPTIMIZATION_LEVEL = 0;
     
    237223                                INFOPLIST_FILE = Info.plist;
    238224                                INSTALL_PATH = "$(HOME)/Applications";
    239                                 MACOSX_DEPLOYMENT_TARGET = 10.4;
    240                                 PREBINDING = NO;
     225                                MACOSX_DEPLOYMENT_TARGET = 10.8;
    241226                                PRODUCT_NAME = Quartz2DBasics.Cocoa;
    242227                                WRAPPER_EXTENSION = app;
     
    248233                        isa = XCBuildConfiguration;
    249234                        buildSettings = {
    250                                 ARCHS = (
    251                                         ppc,
    252                                         i386,
    253                                 );
     235                                ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
     236                                COMBINE_HIDPI_IMAGES = YES;
    254237                                COPY_PHASE_STRIP = YES;
    255                                 GCC_ENABLE_FIX_AND_CONTINUE = NO;
    256238                                GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
    257239                                GCC_PRECOMPILE_PREFIX_HEADER = YES;
     
    259241                                INFOPLIST_FILE = Info.plist;
    260242                                INSTALL_PATH = "$(HOME)/Applications";
    261                                 MACOSX_DEPLOYMENT_TARGET = 10.4;
    262                                 PREBINDING = NO;
     243                                MACOSX_DEPLOYMENT_TARGET = 10.8;
    263244                                PRODUCT_NAME = Quartz2DBasics.Cocoa;
    264245                                WRAPPER_EXTENSION = app;
     
    270251                        isa = XCBuildConfiguration;
    271252                        buildSettings = {
     253                                COMBINE_HIDPI_IMAGES = YES;
    272254                                GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
    273255                                GCC_PRECOMPILE_PREFIX_HEADER = YES;
     
    275257                                INFOPLIST_FILE = Info.plist;
    276258                                INSTALL_PATH = "$(HOME)/Applications";
    277                                 MACOSX_DEPLOYMENT_TARGET = 10.4;
    278                                 PREBINDING = NO;
     259                                MACOSX_DEPLOYMENT_TARGET = 10.8;
    279260                                PRODUCT_NAME = Quartz2DBasics.Cocoa;
    280261                                WRAPPER_EXTENSION = app;
     
    286267                        isa = XCBuildConfiguration;
    287268                        buildSettings = {
    288                                 SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
     269                                SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk";
    289270                        };
    290271                        name = Development;
     
    293274                        isa = XCBuildConfiguration;
    294275                        buildSettings = {
    295                                 SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
     276                                SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk";
    296277                        };
    297278                        name = Deployment;
     
    300281                        isa = XCBuildConfiguration;
    301282                        buildSettings = {
    302                                 SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
     283                                SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk";
    303284                        };
    304285                        name = Default;
  • trunk/SophyaPI/PI/Quartz/pibwdgquartz.cpp

    r4085 r4086  
    1919        HIViewRef rootView;
    2020        HIViewRef contentView;
    21         OSStatus err;
     21        OSStatus err = 0;
    2222        fName = nom;
    2323       
     
    2525        err = HIViewGetBounds (rootView, &localHIRect);
    2626
    27         err = HIScrollViewCreate(kHIScrollViewOptionsVertScroll | kHIScrollViewOptionsHorizScroll, &wdgHIView);
     27        err += HIScrollViewCreate(kHIScrollViewOptionsVertScroll | kHIScrollViewOptionsHorizScroll, &wdgHIView);
    2828        err += HIViewSetVisible (wdgHIView, true);     
    2929       
     
    3838        localHIRect.size.height = (float)sy;
    3939       
    40         err = HIViewSetFrame (wdgHIView, &localHIRect);
     40        err += HIViewSetFrame (wdgHIView, &localHIRect);
    4141       
    4242        err += HIViewGetFrame (wdgHIView, &localHIRect);
     
    4747                                                                                        err,nom);
    4848
    49         err = InstallEventHandler (GetControlEventTarget (wdgHIView),
     49/*
     50 err = InstallEventHandler (GetControlEventTarget (wdgHIView),
    5051                                                                NewEventHandlerUPP (BaseWdgQuartzEventHandler),
    5152                                                                GetEventTypeCount (basewdgSpec),
     
    5354                                                                (void *) this,
    5455                                                                NULL);
    55 
    56         HIViewRender(wdgHIView);
     56*/
     57        printf("PIBaseWdgQuartz::PIBaseWdgQuartz HIView %d \n",contentView);
     58        err += HIViewInstallEventHandler (contentView,
     59                               NewEventHandlerUPP (BaseWdgQuartzEventHandler),
     60                               GetEventTypeCount (basewdgSpec),
     61                               (const EventTypeSpec*)&basewdgSpec,
     62                               (void *) contentView,
     63                               NULL);
     64
     65        HIViewRender(contentView);
    5766        mWGrC = new PIGraphicWin(this);
    5867}
     
    119128{
    120129//      return;
    121         printf("---->> PIBaseWdgQuartz::Refresh -%s- context:%lx\n",fName,mWGrC->GetCGContext());
     130
     131 printf("---->> PIBaseWdgQuartz::Refresh -%s- context:%lx\n",fName,mWGrC->GetCGContext());
    122132        EventRef        rEvent;
    123133        OSStatus err;
     
    133143
    134144        printf(" cg : %lx ox : %g oy : %g width : %g height : %g \n",
    135                         mWGrC->GetCGContext(), hiRect.origin.x, hiRect.origin.y, hiRect.size.width, hiRect.size.height);
     145
     146           mWGrC->GetCGContext(), hiRect.origin.x, hiRect.origin.y, hiRect.size.width, hiRect.size.height);
    136147        // mWGrC->SetGCRect(hiRect.origin.x, hiRect.origin.y, hiRect.size.width, hiRect.size.height);   
    137148        // Draw(mWGrC, 0, 0, XSize(), YSize());
    138149
     150   
     151    if(wdgHIView){
     152                HIViewSetNeedsDisplay(wdgHIView, true);
     153        printf("---->> PIBaseWdgQuartz::Refresh -%s- \n",fName);
     154    }
     155
    139156        return;
    140157}
     
    144161{
    145162        printf("PIBaseWdgQuartz::ExposeProcess -%s- to x:%d y:%d dx:%d dy:%d\n",fName,x0,y0,dx,dy);
    146         if (mWGrC->GetCGContext() == NULL) {
    147                 mWGrC->SetCGContext(cg);
    148                 printf("PIBaseWdgQuartz::ExposeProcess CHANGE context to %lx\n",cg);
    149                 mWGrC->SetCTM(CGContextGetCTM(cg));
    150         }
    151         printf("PIBaseWdgQuartz::ExposeProcess set CTM to %lx\n",cg);
    152         CGContextSaveGState(mWGrC->GetCGContext());
     163    if (1 == 1) {
     164       
     165        if (mWGrC->GetCGContext() == NULL) {
     166            mWGrC->SetCGContext(cg);
     167            printf("PIBaseWdgQuartz::ExposeProcess CHANGE context to %lx\n",cg);
     168            mWGrC->SetCTM(CGContextGetCTM(cg));
     169        } else {
     170           
     171            // Flip the coordinates by translating and scaling. This produces a
     172            // coordinate system that matches the Quartz default coordinate system
     173            // with the origin in the lower-left corner with the y axis pointing up.
     174            HIRect      bounds;
     175            HIViewGetBounds ((HIViewRef) wdgHIView, &bounds);
     176           
     177            //  CGContextTranslateCTM(cg, 0, bounds.size.height);
     178            //  CGContextScaleCTM(cg, 1.0, -1.0)
     179        }
     180    }
     181   
     182    printf("PIBaseWdgQuartz::ExposeProcess set CTM to %lx\n",cg);
     183        CGContextSaveGState(cg);
    153184        Draw(mWGrC, x0, y0, dx, dy);
    154185//      CGContextRestoreGState (cg);
    155         CGContextRestoreGState (mWGrC->GetCGContext());
     186        CGContextRestoreGState (cg);
    156187
    157188        return;
     
    169200        PIGetEventName(event);
    170201
    171         PIBaseWdgQuartz* wdg = (PIBaseWdgQuartz*) userData;
    172         printf("\n BaseWdgQuartzEventHandler -%s- (%d) : ", wdg->fName,counterDraw);
     202//      PIBaseWdgQuartz* wdg = (PIBaseWdgQuartz*) userData;
     203        printf("\n BaseWdgQuartzEventHandler  (%d) : ",counterDraw);
    173204        printf("\n");
    174205
     
    176207        WindowRef           window;
    177208    Rect                bounds;
    178         if (!wdg)
     209        if (!userData)
    179210        return status;
    180211       
    181     status = GetEventParameter (event, kEventParamCGContextRef, typeCGContextRef, NULL, sizeof (CGContextRef), NULL, &cg);
    182 
     212    status = GetEventParameter (event, kEventParamCGContextRef,
     213                                typeCGContextRef, NULL,
     214                                sizeof (CGContextRef),
     215                                NULL,
     216                                &cg);
     217
     218    printf("BaseWdgQuartzEventHandler GET EVENT CLASS:%lx   KIND %d status:%d\n",(long)GetEventClass(event),(int)GetEventKind(event), status);
     219
     220/*  copy form .h file
     221 
     222 static const EventTypeSpec basewdgSpec[] = {
     223        { kEventClassWindow, kEventWindowResizeCompleted},
     224        { kEventClassWindow, kEventWindowDrawContent},
     225        { kEventClassHIObject, kEventHIObjectConstruct },
     226        { kEventClassHIObject, kEventHIObjectInitialize },
     227        { kEventClassHIObject, kEventHIObjectDestruct },
     228        { kEventClassControl, kEventControlClick},
     229        { kEventClassControl, kEventControlBoundsChanged},
     230        { kEventClassControl, kEventControlOwningWindowChanged },
     231        { kEventClassControl, kEventControlInitialize },
     232        { kEventClassControl, kEventControlGetPartRegion },
     233        { kEventClassControl, kEventControlHitTest }
     234    };
     235*/
    183236        switch(GetEventClass(event))
    184237    {
     
    193246            break;
    194247           
    195 */        case kEventClassWindow: {
     248*/
     249        case kEventClassWindow: {
    196250                       
    197251            switch (GetEventKind(event))
     
    201255                                        GetEventParameter( event, kEventParamCurrentBounds, typeQDRectangle, NULL, sizeof(Rect), NULL, &bounds );
    202256                                       
    203 //                                      wdg->adaptResize(bounds.left, bounds.top, bounds.right - bounds.left, bounds.bottom - bounds.top);
    204 //                                      wdg->requestRedraw();
     257                    //                                  wdg->adaptResize(bounds.left, bounds.top, bounds.right - bounds.left, bounds.bottom - bounds.top);
     258                    //                                  wdg->requestRedraw();
    205259                                        status = noErr;
    206260                                        break;
     
    209263                                        InvalWindowRect(window, GetWindowPortBounds(window, &bounds));
    210264                                        GetWindowBounds(window, kWindowContentRgn, &bounds);
    211 //                                      wdg->adaptResize(bounds.left, bounds.top, bounds.right - bounds.left, bounds.bottom - bounds.top);
     265                    //                                  wdg->adaptResize(bounds.left, bounds.top, bounds.right - bounds.left, bounds.bottom - bounds.top);
    212266                                        status = noErr;
    213267                                        break;
     
    218272                                        break;
    219273                                       
    220                                 default:
     274                                default:
     275                    HIViewRef view = (HIViewRef) userData;
     276                    HIRect hiRect;
     277                    HIViewGetFrame(view, &hiRect);
     278                    // Pour le moment on rafraichit toute la vue
     279                    int ox = (int)(hiRect.origin.x);
     280                    int oy = (int)(hiRect.origin.x);
     281                    int dx = (int)(hiRect.size.width);
     282                    int dy = (int)(hiRect.size.height);
     283///                    wdg->eXposeProcess(cg, 0 , 0, dx, dy);
    221284                                        break;
    222285                        }
     
    224287                }
    225288                case kEventClassControl : {                     
    226                         case kEventControlDraw: {
    227                                 // wdg->SetQuartzCGContext(cg);
    228                                 HIViewRef view = wdg->GetHIViewRef();
    229                                 HIRect hiRect;
    230                                 HIViewGetFrame(view, &hiRect);
    231                                 // Pour le moment on rafraichit toute la vue
    232                                 int ox = (int)(hiRect.origin.x);
    233                                 int oy = (int)(hiRect.origin.x);
    234                                 int dx = (int)(hiRect.size.width);
    235                                 int dy = (int)(hiRect.size.height);
    236                                 printf("-->> PIbWdgquartz::BaseWdgQuartzEventHandler -%s- cg : %lx [%d %d] Frame [%d, %d] \n", wdg->fName,(unsigned long)cg, ox, oy, dx, dy);
    237                        
    238                                 HIRect      bounds;
    239                                 HIViewGetBounds ((HIViewRef) userData, &bounds);
    240                                 printf("-->> PIbWdgquartz::BaseWdgQuartzEventHandler BOUNDS [%f %f] SIZE [%f, %f] \n",hiRect.origin.x,hiRect.origin.y,hiRect.size.width,hiRect.size.height);
    241                                 //              err = HIViewSetFrame (wdgHIView, &localHIRect);
    242                                
    243                                 wdg->eXposeProcess(cg, 0 , 0, dx, dy);
    244                         }
     289            switch (GetEventKind(event))
     290                        {
     291                case kEventControlDraw: {
     292                    // wdg->SetQuartzCGContext(cg);
     293                    HIViewRef view = (HIViewRef) userData;
     294                    HIRect hiRect;
     295                    HIViewGetFrame(view, &hiRect);
     296                    // Pour le moment on rafraichit toute la vue
     297                    int ox = (int)(hiRect.origin.x);
     298                    int oy = (int)(hiRect.origin.x);
     299                    int dx = (int)(hiRect.size.width);
     300                    int dy = (int)(hiRect.size.height);
     301                    printf("-->> PIbWdgquartz::BaseWdgQuartzEventHandler cg : %lx [%d %d] Frame [%d, %d] \n", (unsigned long)cg, ox, oy, dx, dy);
     302                   
     303                    HIRect      bounds;
     304                    HIViewGetBounds ((HIViewRef) userData, &bounds);
     305                    printf("-->> PIbWdgquartz::BaseWdgQuartzEventHandler BOUNDS [%f %f] SIZE [%f, %f] \n",hiRect.origin.x,hiRect.origin.y,hiRect.size.width,hiRect.size.height);
     306                    //          err = HIViewSetFrame (wdgHIView, &localHIRect);
     307                   
     308///                    wdg->eXposeProcess(cg, 0 , 0, dx, dy);
     309                }
     310                default: {
     311                    printf("unknown: %g\n",GetEventClass(event));
     312                    break;
     313                }
     314                    break;
     315            }
    245316                        break;
    246                 }
    247                         break; 
     317        }
    248318        default:
    249319            printf("unknown: %g\n",GetEventClass(event));
    250320            break;
    251     }
     321        }
    252322       
    253323        /////
  • trunk/SophyaPI/PI/Quartz/pibwdgquartz.h

    r4081 r4086  
    1616#include "pigraphps.h"
    1717
    18 /*
     18
    1919static const EventTypeSpec basewdgSpec[] = {
    2020                                                                                         { kEventClassWindow, kEventWindowClose},
     
    2222                                                                                         { kEventClassWindow, kEventWindowDrawContent},
    2323                                                                                         { kEventClassWindow, kEventWindowBoundsChanged },
     24                                             { kEventClassWindow, kEventWindowBoundsChanging },
    2425                                                                                         { kEventClassHIObject, kEventHIObjectConstruct },
    2526                                                                                         { kEventClassHIObject, kEventHIObjectInitialize },
     
    3435                                                                                         };
    3536
     37
     38
     39/*
     40 static const EventTypeSpec basewdgSpec[] = {{ kEventClassControl, kEventControlDraw},{kEventWindowBoundsChanged,kEventWindowResizeCompleted}};
    3641*/
    37 
    38 static const EventTypeSpec basewdgSpec[] = {{ kEventClassControl, kEventControlDraw},{kEventWindowBoundsChanged,kEventWindowResizeCompleted}};
    39 
    4042
    4143class PIBaseWdgQuartz : public PIBaseWdgGen
  • trunk/SophyaPI/PI/piapplx.cc

    r4083 r4086  
    127127msy+=5;
    128128topwdg->SetSize(sx, sy+msy);
    129 //DBG printf("PIApplicationX-DBG:: Size=%d %d \n", topwdg->XSize(), topwdg->YSize());
     129printf("PIApplicationX-DBG:: Size=%d %d \n", topwdg->XSize(), topwdg->YSize());
    130130
    131131intcont = new PIContainerX((PIMsgHandler *)this, topwdg, "MBCont",
  • trunk/SophyaPI/PI/pibwdggen.cc

    r2780 r4086  
    612612{
    613613  if (mDrwList.size() < 1)  return -1;
    614   double xmin,ymin, xmax, ymax;
     614//  double xmin,ymin, xmax, ymax;
    615615  int drx0, dry0, drdx, drdy;
    616616  int ddrx0, ddry0, ddrdx, ddrdy;
  • trunk/SophyaPI/PI/picons.cc

    r2676 r4086  
    107107PIBaseWdg(par, nom, ((scb)?sx-Scb_Width:sx), sy, px, py)
    108108{
    109 mNL = (nl > 10) ? nl : 10;
     109    printf("PIConsole::PIConsole sizeX:%d sizeY:%d\n",XSize(), YSize());
     110    mNL = (nl > 10) ? nl : 10;
    110111mNC = (nc > 30) ? nc : 30;
    111112mText = new char[mNL*mNC];
     
    146147SelectFont();
    147148SelFgBgCol();
    148 mCurL = mNL-mWSzL-1;
     149//mCurL = mNL-mWSzL-1;
     150mCurL = 0;
    149151mCurC = 0;
    150152
     
    274276void PIConsole::SelectFont(PIFontSize sz)
    275277{
    276 int asc, desc;
     278    printf("+++PIConsole::SelectFont %d %d\n",XSize(),YSize());
     279    int asc, desc;
    277280mWGrC->SelFont(sz);
    278281mFTaille = sz;
  • trunk/SophyaPI/PI/pidrwtools.cc

    r3475 r4086  
    821821void PIDrwOptionStringWindow::Process(PIMessage msg, PIMsgHandler* sender, void* data)
    822822{
    823   PIMessage mod = ModMsg(msg);
     823//  PIMessage mod = ModMsg(msg);
    824824  msg = UserMsg(msg);
    825825  switch (msg) {
     
    14551455  int aid = mBWdg->GetActiveDrawerId();
    14561456  PIDrawer* actdrw = mBWdg->GetActiveDrawer();
    1457   PIMessage mod = ModMsg(msg);
     1457//  PIMessage mod = ModMsg(msg);
    14581458  msg = UserMsg(msg);
    14591459  switch (msg) {
  • trunk/SophyaPI/PI/pigraphps.cc

    r4083 r4086  
    389389
    390390
    391 static int fntsz[5] = {8,10,12,14,16};
     391//static int fntsz[5] = {8,10,12,14,16};
    392392
    393393/* --Methode-- */
  • trunk/SophyaPI/PI/psfile.cc

    r4083 r4086  
    899899  int nce = 0;
    900900  int ls = strlen(s);
    901   int i,j,k;
     901  int j;
    902902  for(int k=0; k<ls; k++)
    903903    if ( (s[k] == '(') || (s[k] == ')') || (s[k] == '\\') ) nce++;
Note: See TracChangeset for help on using the changeset viewer.