Quellcode durchsuchen

cmGrPageLayout() now returns bool.

master
kpl vor 11 Jahren
Ursprung
Commit
186cabcf32
2 geänderte Dateien mit 18 neuen und 18 gelöschten Zeilen
  1. 17
    17
      cmGrPage.c
  2. 1
    1
      cmGrPage.h

+ 17
- 17
cmGrPage.c Datei anzeigen

261
     default:
261
     default:
262
       { assert(0); }
262
       { assert(0); }
263
   }
263
   }
264
-
265
-
266
 } 
264
 } 
267
 
265
 
268
 
266
 
294
 
292
 
295
   cmGrPg_t* p = _cmGrPgHandleToPtr(*hp);
293
   cmGrPg_t* p = _cmGrPgHandleToPtr(*hp);
296
 
294
 
297
-
298
   if((rc = _cmGrPgDestroy(p)) != kOkGrRC )
295
   if((rc = _cmGrPgDestroy(p)) != kOkGrRC )
299
     return rc;
296
     return rc;
300
 
297
 
418
   
415
   
419
 
416
 
420
   // Create a negative string with a repeating decimal to simulate an arbitrary hash label
417
   // Create a negative string with a repeating decimal to simulate an arbitrary hash label
421
-  // Use the measurements pgom this string to compute the geometry of the view layouts.
418
+  // Use the measurements from this string to compute the geometry of the view layouts.
422
   char label[ kHashCharCnt + 1];
419
   char label[ kHashCharCnt + 1];
423
   snprintf(label,kHashCharCnt,"%f",-4.0/3.0); 
420
   snprintf(label,kHashCharCnt,"%f",-4.0/3.0); 
424
   label[kHashCharCnt] = 0;
421
   label[kHashCharCnt] = 0;
635
 
632
 
636
 }
633
 }
637
 
634
 
638
-void  _cmGrPageLayout( cmGrPg_t* p, cmGrDcH_t dcH )
635
+bool  _cmGrPageLayout( cmGrPg_t* p, cmGrDcH_t dcH )
639
 {
636
 {
640
   unsigned  i;
637
   unsigned  i;
641
 
638
 
642
   if( cmIsNotFlag(p->flags,kDirtyFl) )
639
   if( cmIsNotFlag(p->flags,kDirtyFl) )
643
-    return;
640
+    return false;
644
 
641
 
645
   cmGrDcSetFontFamily(dcH,kHelveticaFfGrId);
642
   cmGrDcSetFontFamily(dcH,kHelveticaFfGrId);
646
   cmGrDcSetFontSize(dcH,10);
643
   cmGrDcSetFontSize(dcH,10);
647
 
644
 
648
   // Create a negative string with a repeating decimal to simulate an arbitrary hash label
645
   // Create a negative string with a repeating decimal to simulate an arbitrary hash label
649
   // Use the measurements pgom this string to compute the geometry of the view layouts.
646
   // Use the measurements pgom this string to compute the geometry of the view layouts.
647
+  /*
650
   char label[ kHashCharCnt + 1];
648
   char label[ kHashCharCnt + 1];
651
   cmGrPSz_t sz;
649
   cmGrPSz_t sz;
652
   snprintf(label,kHashCharCnt,"%f",-4.0/3.0); 
650
   snprintf(label,kHashCharCnt,"%f",-4.0/3.0); 
653
   label[kHashCharCnt] = 0;
651
   label[kHashCharCnt] = 0;
654
   cmGrDcMeasure(dcH,label,&sz);
652
   cmGrDcMeasure(dcH,label,&sz);
653
+  */
655
 
654
 
656
   _cmGrPgLayoutVwPosition(p);
655
   _cmGrPgLayoutVwPosition(p);
657
 
656
 
663
   }
662
   }
664
 
663
 
665
   p->flags = cmClrFlag(p->flags,kDirtyFl);
664
   p->flags = cmClrFlag(p->flags,kDirtyFl);
665
+
666
+  return true;
666
 }
667
 }
667
 
668
 
668
 cmGrRC_t cmGrPageInit( cmGrPgH_t h, const cmGrPExt_t* r, unsigned rn, unsigned cn, cmGrDcH_t dcH  )
669
 cmGrRC_t cmGrPageInit( cmGrPgH_t h, const cmGrPExt_t* r, unsigned rn, unsigned cn, cmGrDcH_t dcH  )
669
 {
670
 {
671
+  cmGrRC_t rc = kOkGrRC;
670
   cmGrPg_t* p = _cmGrPgHandleToPtr(h);
672
   cmGrPg_t* p = _cmGrPgHandleToPtr(h);
671
   unsigned i;
673
   unsigned i;
672
 
674
 
730
     p->flags = cmSetFlag(p->flags,kDirtyFl);
732
     p->flags = cmSetFlag(p->flags,kDirtyFl);
731
 
733
 
732
     // layout the page
734
     // layout the page
733
-    _cmGrPageLayout(p, dcH );
735
+    // kpl _cmGrPageLayout(p, dcH );
734
 
736
 
735
     // notify the application that views have been created
737
     // notify the application that views have been created
736
     for(i=0; i<rn*cn; ++i)
738
     for(i=0; i<rn*cn; ++i)
739
       
741
       
740
       // Set the 'id' assoc'd with this views cmGrH_t handle to 'i'. 
742
       // Set the 'id' assoc'd with this views cmGrH_t handle to 'i'. 
741
       // This will allow the grH to return the index of the plot.
743
       // This will allow the grH to return the index of the plot.
742
-      if( cmGrCreate(&p->ctx,&vp->grH,i,kExpandViewGrFl,_cmGrPageCallback,p,NULL) == kOkGrRC )
743
-      {
744
-        //if( p->rspdr != NULL )
745
-        //  p->rspdr->on_view_create( p->rspdrArg, i );
746
-      }
744
+      if((rc = cmGrCreate(&p->ctx,&vp->grH,i,kExpandViewGrFl,_cmGrPageCallback,p,NULL)) != kOkGrRC )
745
+        break;
747
     }
746
     }
748
   }    
747
   }    
749
-  return kOkGrRC;
748
+  return rc;
750
 }
749
 }
751
 
750
 
752
 
751
 
760
   p->flags = cmSetFlag(p->flags,kDirtyFl);
759
   p->flags = cmSetFlag(p->flags,kDirtyFl);
761
 
760
 
762
   // layout the page
761
   // layout the page
763
-  _cmGrPageLayout(p, dcH );
762
+  // kpl _cmGrPageLayout(p, dcH );
764
 
763
 
765
   return kOkGrRC;
764
   return kOkGrRC;
766
 }
765
 }
984
 }
983
 }
985
 
984
 
986
 
985
 
987
-void     cmGrPageLayout( cmGrPgH_t h, cmGrDcH_t dcH )
988
-{
986
+bool     cmGrPageLayout( cmGrPgH_t h, cmGrDcH_t dcH )
987
+{  
989
   cmGrPg_t* p = _cmGrPgHandleToPtr(h);
988
   cmGrPg_t* p = _cmGrPgHandleToPtr(h);
990
   cmGrDcPushCtx(dcH);
989
   cmGrDcPushCtx(dcH);
991
-  _cmGrPageLayout(p,dcH);
990
+  bool fl = _cmGrPageLayout(p,dcH);
992
   cmGrDcPopCtx(dcH);
991
   cmGrDcPopCtx(dcH);
992
+  return fl;
993
 }
993
 }
994
 
994
 
995
 void     cmGrPageDraw( cmGrPgH_t h, cmGrDcH_t dcH )
995
 void     cmGrPageDraw( cmGrPgH_t h, cmGrDcH_t dcH )

+ 1
- 1
cmGrPage.h Datei anzeigen

55
   cmGrVwH_t cmGrPageFocusedView( cmGrPgH_t h );
55
   cmGrVwH_t cmGrPageFocusedView( cmGrPgH_t h );
56
 
56
 
57
   // 
57
   // 
58
-  void      cmGrPageLayout( cmGrPgH_t h, cmGrDcH_t dcH );
58
+  bool      cmGrPageLayout( cmGrPgH_t h, cmGrDcH_t dcH );
59
 
59
 
60
   // Draw the page.
60
   // Draw the page.
61
   void      cmGrPageDraw( cmGrPgH_t h, cmGrDcH_t dcH );
61
   void      cmGrPageDraw( cmGrPgH_t h, cmGrDcH_t dcH );

Laden…
Abbrechen
Speichern