[Igarden-commit] Garden/source/PlanTool ActiveMaterial.h, 1.10.2.1, 1.10.2.2 ActiveMaterial.cpp, 1.
Status: Beta
Brought to you by:
jlbedell
|
From: Jeffrey B. <jlb...@us...> - 2006-11-04 01:54:37
|
Update of /cvsroot/igarden/Garden/source/PlanTool In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv7332 Modified Files: Tag: Release_branch_v1 ActiveMaterial.h ActiveMaterial.cpp Log Message: Add category select menu Index: ActiveMaterial.cpp =================================================================== RCS file: /cvsroot/igarden/Garden/source/PlanTool/ActiveMaterial.cpp,v retrieving revision 1.45.2.1 retrieving revision 1.45.2.2 diff -C2 -d -r1.45.2.1 -r1.45.2.2 *** ActiveMaterial.cpp 2 Nov 2006 23:47:24 -0000 1.45.2.1 --- ActiveMaterial.cpp 4 Nov 2006 01:54:33 -0000 1.45.2.2 *************** *** 60,75 **** const long kMaterialErrText = 102; const long kPaletteSelectMenu = 106; const long kActiveMenuFont = 139; ! const long kSeparatorItem = 3; ! const long kAccentMenuItem = 4; ! const long kDeckMenuItem = 5; ! const long kNaturalMenuItem = 6; ! const long kOtherMenuItem = 7; ! const long kStairMenuItem = 8; ! const long kStructureMenuItem = 9; ! const long kWalkMenuItem = 10; ! const long kWallMenuItem = 11; ! const long kWaterMenuItem = 12; BEGINDISPATCH(ActiveMaterial,XGView) --- 60,75 ---- const long kMaterialErrText = 102; const long kPaletteSelectMenu = 106; + const long kCategorySelectMenu = 107; const long kActiveMenuFont = 139; ! const long kAccentMenuItem = 0; ! const long kDeckMenuItem = 1; ! const long kNaturalMenuItem = 2; ! const long kOtherMenuItem = 3; ! const long kStairMenuItem = 4; ! const long kStructureMenuItem = 5; ! const long kWalkMenuItem = 6; ! const long kWallMenuItem = 7; ! const long kWaterMenuItem = 8; BEGINDISPATCH(ActiveMaterial,XGView) *************** *** 195,198 **** --- 195,199 ---- UInt32 ActiveMaterial::GetNumMaterials() { + uint32 result; switch(_paletteType) { *************** *** 208,212 **** case kHardscapeItems: MyAssert(_hardscapeIndex < (sizeof(_hardscape)/sizeof(hardscapeElem_t))); ! return _hardscape[_hardscapeIndex].elem.Length() + 1; default: return 0; --- 209,214 ---- case kHardscapeItems: MyAssert(_hardscapeIndex < (sizeof(_hardscape)/sizeof(hardscapeElem_t))); ! result = _hardscape[_hardscapeIndex].elem.Length() + 1; ! return result; default: return 0; *************** *** 285,289 **** { ! XGSViewInitRecord popupInfo, imageInfo; struct XGSTextInitRecord staticInfo, nameInfo; Point myPaneSize; --- 287,291 ---- { ! XGSViewInitRecord popupInfo, imageInfo, catPopInfo; struct XGSTextInitRecord staticInfo, nameInfo; Point myPaneSize; *************** *** 299,302 **** --- 301,305 ---- myPaneSize = GetSize(); + #if 1 popupInfo.fViewID = kPaletteSelectMenu; popupInfo.fVisible = true; *************** *** 311,328 **** popupInfo.fAutoBottom = -BORDER_WIDTH; _palettePopup = new XGPopControl(this, popupInfo, kActiveMenuFont); _palettePopup->Insert(0,"All in document"); _palettePopup->Insert(1,"All in this plot"); _palettePopup->Insert(2,"Backgrounds"); ! _palettePopup->Insert(3,"-"); ! _palettePopup->Insert(kAccentMenuItem,"Accents"); ! _palettePopup->Insert(kDeckMenuItem,"Decks and Patios"); ! _palettePopup->Insert(kNaturalMenuItem,"Natural Items"); ! _palettePopup->Insert(kOtherMenuItem,"Other Hardscape"); ! _palettePopup->Insert(kStairMenuItem,"Stairs"); ! _palettePopup->Insert(kStructureMenuItem,"Structures"); ! _palettePopup->Insert(kWalkMenuItem,"Walks"); ! _palettePopup->Insert(kWallMenuItem,"Walls and Fences"); ! _palettePopup->Insert(kWaterMenuItem,"Water Features"); popupInfo.fViewID = kMaterialSelectMenu; popupInfo.fVisible = true; --- 314,328 ---- popupInfo.fAutoBottom = -BORDER_WIDTH; _palettePopup = new XGPopControl(this, popupInfo, kActiveMenuFont); + #else + _palettePopup = dynamic_cast<XGPopControl*>(parent->FindViewByID(kPaletteSelectMenu)); + AssertValidView(_palettePopup); + #endif _palettePopup->Insert(0,"All in document"); _palettePopup->Insert(1,"All in this plot"); _palettePopup->Insert(2,"Backgrounds"); ! _palettePopup->Insert(3,"Non-Plant Materials"); ! // _palettePopup->Insert(4,"-"); + #if 1 popupInfo.fViewID = kMaterialSelectMenu; popupInfo.fVisible = true; *************** *** 333,344 **** popupInfo.fLockBottom = true; popupInfo.fAutoLeft = BORDER_WIDTH; //myPaneSize.h - (BORDER_WIDTH+20); ! popupInfo.fAutoTop = myPaneSize.v - ((2*POPUP_HEIGHT) + BORDER_WIDTH); popupInfo.fAutoRight = -BORDER_WIDTH; ! popupInfo.fAutoBottom = -(BORDER_WIDTH+POPUP_HEIGHT); _popup = new XGPopControl(this, popupInfo, kActiveMenuFont); ! _popup->Insert(0,"-"); // _popup->Insert(1,"Edit Current PaletteÉ"); // _popup->Insert(2,"Create New PaletteÉ"); nameInfo.v.fViewID = kMaterialNameText; nameInfo.v.fVisible = true; --- 333,380 ---- popupInfo.fLockBottom = true; popupInfo.fAutoLeft = BORDER_WIDTH; //myPaneSize.h - (BORDER_WIDTH+20); ! popupInfo.fAutoTop = myPaneSize.v - ((3*POPUP_HEIGHT) + BORDER_WIDTH); popupInfo.fAutoRight = -BORDER_WIDTH; ! popupInfo.fAutoBottom = -(BORDER_WIDTH+(2*POPUP_HEIGHT)); _popup = new XGPopControl(this, popupInfo, kActiveMenuFont); ! #else ! _popup = dynamic_cast<XGPopControl*>(this->FindViewByID(kMaterialSelectMenu)); ! AssertValidView(_popup); ! #endif ! // _popup->Insert(0,"-"); // _popup->Insert(1,"Edit Current PaletteÉ"); // _popup->Insert(2,"Create New PaletteÉ"); + #if 1 + catPopInfo.fViewID = kCategorySelectMenu; + catPopInfo.fVisible = false; + catPopInfo.fEnabled = true; + catPopInfo.fLockLeft = true; + catPopInfo.fLockTop = true; + catPopInfo.fLockRight = true; + catPopInfo.fLockBottom = true; + catPopInfo.fAutoLeft = BORDER_WIDTH+20; //myPaneSize.h - (BORDER_WIDTH+20); + catPopInfo.fAutoTop = myPaneSize.v - ((2*POPUP_HEIGHT) + BORDER_WIDTH); + catPopInfo.fAutoRight = -BORDER_WIDTH; + catPopInfo.fAutoBottom = -(BORDER_WIDTH+POPUP_HEIGHT); + #else + _categoryPopup = dynamic_cast<XGPopControl*>(this->FindViewByID(kMaterialSelectMenu)); + AssertValidView(_categoryPopup); + #endif + _categoryPopup = new XGPopControl(this, catPopInfo, kActiveMenuFont); + _categoryPopup->Insert(kAccentMenuItem,"Accents"); + _categoryPopup->Insert(kDeckMenuItem,"Decks and Patios"); + _categoryPopup->Insert(kNaturalMenuItem,"Natural Items"); + _categoryPopup->Insert(kOtherMenuItem,"Other Hardscape"); + _categoryPopup->Insert(kStairMenuItem,"Stairs"); + _categoryPopup->Insert(kStructureMenuItem,"Structures"); + _categoryPopup->Insert(kWalkMenuItem,"Walks"); + _categoryPopup->Insert(kWallMenuItem,"Walls and Fences"); + _categoryPopup->Insert(kWaterMenuItem,"Water Features"); + + popupInfo.fAutoLeft = BORDER_WIDTH; //myPaneSize.h - (BORDER_WIDTH+20); + popupInfo.fAutoTop = myPaneSize.v - ((3*POPUP_HEIGHT) + BORDER_WIDTH); + popupInfo.fAutoRight = -BORDER_WIDTH; + popupInfo.fAutoBottom = -(BORDER_WIDTH+(2*POPUP_HEIGHT)); + _popup = new XGPopControl(this, popupInfo, kActiveMenuFont); nameInfo.v.fViewID = kMaterialNameText; nameInfo.v.fVisible = true; *************** *** 363,369 **** imageInfo.fAutoTop = BORDER_WIDTH; imageInfo.fAutoRight = -BORDER_WIDTH; ! imageInfo.fAutoBottom = -(BORDER_WIDTH + (2*POPUP_HEIGHT) + NAME_HEIGHT); width = myPaneSize.h - (2 * BORDER_WIDTH); ! height = myPaneSize.v - ((2 * BORDER_WIDTH) + (2*POPUP_HEIGHT) + NAME_HEIGHT); if(height < width) { --- 399,405 ---- imageInfo.fAutoTop = BORDER_WIDTH; imageInfo.fAutoRight = -BORDER_WIDTH; ! imageInfo.fAutoBottom = -(BORDER_WIDTH + (3*POPUP_HEIGHT) + NAME_HEIGHT); width = myPaneSize.h - (2 * BORDER_WIDTH); ! height = myPaneSize.v - ((2 * BORDER_WIDTH) + (3*POPUP_HEIGHT) + NAME_HEIGHT); if(height < width) { *************** *** 501,504 **** --- 537,542 ---- } } + if(!foundSeper) + _popup->DeleteAll(); /****/ *************** *** 548,552 **** { index = mat->GetMaterialType() & kMinorMaterialType; ! printf("Mat %s is index %ld\n", mat->GetCommonName().c_str(), index); if(index > (sizeof(_hardscape)/sizeof(hardscapeElem_t))) index = kMaterialTypeHardscape & kMinorMaterialType; --- 586,590 ---- { index = mat->GetMaterialType() & kMinorMaterialType; ! // printf("Mat %s is index %ld\n", mat->GetCommonName().c_str(), index); if(index > (sizeof(_hardscape)/sizeof(hardscapeElem_t))) index = kMaterialTypeHardscape & kMinorMaterialType; *************** *** 791,849 **** case 0: _paletteType = kUsePalette; break; case 1: _paletteType = kInThisPlot; RebuildPlotPalette(); break; case 2: _paletteType = kBackgroundItems; RebuildPlotPalette(); break; case 3: - return -1; // Drop out completely, it's the separator - case kAccentMenuItem: _paletteType = kHardscapeItems; _hardscapeIndex = kMaterialTypeAccents & kMinorMaterialType; - RebuildPlotPalette(); break; case kDeckMenuItem: - _paletteType = kHardscapeItems; _hardscapeIndex = kMaterialTypeDeckPatio & kMinorMaterialType; - RebuildPlotPalette(); break; case kNaturalMenuItem: - _paletteType = kHardscapeItems; _hardscapeIndex = kMaterialTypeNaturalItems & kMinorMaterialType; - RebuildPlotPalette(); break; case kOtherMenuItem: - _paletteType = kHardscapeItems; _hardscapeIndex = kMaterialTypeHardscape & kMinorMaterialType; - RebuildPlotPalette(); break; case kStairMenuItem: - _paletteType = kHardscapeItems; _hardscapeIndex = kMaterialTypeSteps & kMinorMaterialType; - RebuildPlotPalette(); break; case kStructureMenuItem: - _paletteType = kHardscapeItems; _hardscapeIndex = kMaterialTypeStructure & kMinorMaterialType; - RebuildPlotPalette(); break; case kWalkMenuItem: - _paletteType = kHardscapeItems; _hardscapeIndex = kMaterialTypeWalks & kMinorMaterialType; - RebuildPlotPalette(); break; case kWallMenuItem: - _paletteType = kHardscapeItems; _hardscapeIndex = kMaterialTypeWallsFences & kMinorMaterialType; - RebuildPlotPalette(); break; case kWaterMenuItem: - _paletteType = kHardscapeItems; _hardscapeIndex = kMaterialTypeWaterFeature & kMinorMaterialType; - RebuildPlotPalette(); break; } --- 829,886 ---- case 0: _paletteType = kUsePalette; + _categoryPopup->HideView(); break; case 1: _paletteType = kInThisPlot; RebuildPlotPalette(); + _categoryPopup->HideView(); break; case 2: _paletteType = kBackgroundItems; RebuildPlotPalette(); + _categoryPopup->HideView(); break; case 3: _paletteType = kHardscapeItems; + _hardscapeIndex = 0; + _categoryPopup->ShowView(); + return DoPopValue(kCategorySelectMenu, NULL); + } + UpdateMaterialPaletteMenu(); + if(GetNumMaterials() > 0) + PickMaterial(0); + result = 0; + break; + + case kCategorySelectMenu: + menuItem = _categoryPopup->GetValue(); + switch(menuItem) + { + case kAccentMenuItem: _hardscapeIndex = kMaterialTypeAccents & kMinorMaterialType; break; case kDeckMenuItem: _hardscapeIndex = kMaterialTypeDeckPatio & kMinorMaterialType; break; case kNaturalMenuItem: _hardscapeIndex = kMaterialTypeNaturalItems & kMinorMaterialType; break; case kOtherMenuItem: _hardscapeIndex = kMaterialTypeHardscape & kMinorMaterialType; break; case kStairMenuItem: _hardscapeIndex = kMaterialTypeSteps & kMinorMaterialType; break; case kStructureMenuItem: _hardscapeIndex = kMaterialTypeStructure & kMinorMaterialType; break; case kWalkMenuItem: _hardscapeIndex = kMaterialTypeWalks & kMinorMaterialType; break; case kWallMenuItem: _hardscapeIndex = kMaterialTypeWallsFences & kMinorMaterialType; break; case kWaterMenuItem: _hardscapeIndex = kMaterialTypeWaterFeature & kMinorMaterialType; break; } *************** *** 851,854 **** --- 888,892 ---- _hardscapeIndex = kMaterialTypeHardscape & kMinorMaterialType; + RebuildPlotPalette(); UpdateMaterialPaletteMenu(); if(GetNumMaterials() > 0) Index: ActiveMaterial.h =================================================================== RCS file: /cvsroot/igarden/Garden/source/PlanTool/ActiveMaterial.h,v retrieving revision 1.10.2.1 retrieving revision 1.10.2.2 diff -C2 -d -r1.10.2.1 -r1.10.2.2 *** ActiveMaterial.h 2 Nov 2006 23:47:24 -0000 1.10.2.1 --- ActiveMaterial.h 4 Nov 2006 01:54:33 -0000 1.10.2.2 *************** *** 103,106 **** --- 103,107 ---- // attributes paletteType_t _paletteType; + XGPopControl* _categoryPopup; XGPopControl* _palettePopup; XGPopControl* _popup; |