Browse Source

cmGrPageLayout() now returns bool.

master
kpl 11 years ago
parent
commit
186cabcf32
2 changed files with 18 additions and 18 deletions
  1. 17
    17
      cmGrPage.c
  2. 1
    1
      cmGrPage.h

+ 17
- 17
cmGrPage.c View File

@@ -261,8 +261,6 @@ void _cmGrPageCallback( void* arg, cmGrH_t grH, cmGrCbId_t id, unsigned eventFla
261 261
     default:
262 262
       { assert(0); }
263 263
   }
264
-
265
-
266 264
 } 
267 265
 
268 266
 
@@ -294,7 +292,6 @@ cmGrRC_t cmGrPageDestroy( cmGrPgH_t* hp )
294 292
 
295 293
   cmGrPg_t* p = _cmGrPgHandleToPtr(*hp);
296 294
 
297
-
298 295
   if((rc = _cmGrPgDestroy(p)) != kOkGrRC )
299 296
     return rc;
300 297
 
@@ -418,7 +415,7 @@ void _cmGrPgLayoutView( cmGrPg_t* p, cmGrPgVw_t* vp, cmGrDcH_t dcH )
418 415
   
419 416
 
420 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 419
   char label[ kHashCharCnt + 1];
423 420
   snprintf(label,kHashCharCnt,"%f",-4.0/3.0); 
424 421
   label[kHashCharCnt] = 0;
@@ -635,23 +632,25 @@ void _cmGrPgLayoutView( cmGrPg_t* p, cmGrPgVw_t* vp, cmGrDcH_t dcH )
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 637
   unsigned  i;
641 638
 
642 639
   if( cmIsNotFlag(p->flags,kDirtyFl) )
643
-    return;
640
+    return false;
644 641
 
645 642
   cmGrDcSetFontFamily(dcH,kHelveticaFfGrId);
646 643
   cmGrDcSetFontSize(dcH,10);
647 644
 
648 645
   // Create a negative string with a repeating decimal to simulate an arbitrary hash label
649 646
   // Use the measurements pgom this string to compute the geometry of the view layouts.
647
+  /*
650 648
   char label[ kHashCharCnt + 1];
651 649
   cmGrPSz_t sz;
652 650
   snprintf(label,kHashCharCnt,"%f",-4.0/3.0); 
653 651
   label[kHashCharCnt] = 0;
654 652
   cmGrDcMeasure(dcH,label,&sz);
653
+  */
655 654
 
656 655
   _cmGrPgLayoutVwPosition(p);
657 656
 
@@ -663,10 +662,13 @@ void  _cmGrPageLayout( cmGrPg_t* p, cmGrDcH_t dcH )
663 662
   }
664 663
 
665 664
   p->flags = cmClrFlag(p->flags,kDirtyFl);
665
+
666
+  return true;
666 667
 }
667 668
 
668 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 672
   cmGrPg_t* p = _cmGrPgHandleToPtr(h);
671 673
   unsigned i;
672 674
 
@@ -730,7 +732,7 @@ cmGrRC_t cmGrPageInit( cmGrPgH_t h, const cmGrPExt_t* r, unsigned rn, unsigned c
730 732
     p->flags = cmSetFlag(p->flags,kDirtyFl);
731 733
 
732 734
     // layout the page
733
-    _cmGrPageLayout(p, dcH );
735
+    // kpl _cmGrPageLayout(p, dcH );
734 736
 
735 737
     // notify the application that views have been created
736 738
     for(i=0; i<rn*cn; ++i)
@@ -739,14 +741,11 @@ cmGrRC_t cmGrPageInit( cmGrPgH_t h, const cmGrPExt_t* r, unsigned rn, unsigned c
739 741
       
740 742
       // Set the 'id' assoc'd with this views cmGrH_t handle to 'i'. 
741 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,7 +759,7 @@ cmGrRC_t cmGrPageResize( cmGrPgH_t h, const cmGrPExt_t* r, cmGrDcH_t dcH )
760 759
   p->flags = cmSetFlag(p->flags,kDirtyFl);
761 760
 
762 761
   // layout the page
763
-  _cmGrPageLayout(p, dcH );
762
+  // kpl _cmGrPageLayout(p, dcH );
764 763
 
765 764
   return kOkGrRC;
766 765
 }
@@ -984,12 +983,13 @@ cmGrVwH_t cmGrPageFocusedView( cmGrPgH_t h )
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 988
   cmGrPg_t* p = _cmGrPgHandleToPtr(h);
990 989
   cmGrDcPushCtx(dcH);
991
-  _cmGrPageLayout(p,dcH);
990
+  bool fl = _cmGrPageLayout(p,dcH);
992 991
   cmGrDcPopCtx(dcH);
992
+  return fl;
993 993
 }
994 994
 
995 995
 void     cmGrPageDraw( cmGrPgH_t h, cmGrDcH_t dcH )

+ 1
- 1
cmGrPage.h View File

@@ -55,7 +55,7 @@ extern "C" {
55 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 60
   // Draw the page.
61 61
   void      cmGrPageDraw( cmGrPgH_t h, cmGrDcH_t dcH );

Loading…
Cancel
Save