[Igarden-commit] CommonSource/YAAFExtensions PictureSelectDialog.h, 1.9.2.2, 1.9.2.3 PictureSelectD
Status: Beta
Brought to you by:
jlbedell
|
From: Jeffrey B. <jlb...@us...> - 2008-04-12 21:24:13
|
Update of /cvsroot/igarden/CommonSource/YAAFExtensions In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv6529/YAAFExtensions Modified Files: Tag: Release_branch_v1 PictureSelectDialog.h PictureSelectDialog.cpp Log Message: Lock picture metadata fields for pictures loaded by the application (ex: from a web site) Index: PictureSelectDialog.cpp =================================================================== RCS file: /cvsroot/igarden/CommonSource/YAAFExtensions/PictureSelectDialog.cpp,v retrieving revision 1.13.2.8 retrieving revision 1.13.2.9 diff -C2 -d -r1.13.2.8 -r1.13.2.9 *** PictureSelectDialog.cpp 12 Apr 2008 19:02:16 -0000 1.13.2.8 --- PictureSelectDialog.cpp 12 Apr 2008 21:24:14 -0000 1.13.2.9 *************** *** 74,77 **** --- 74,78 ---- _pasted = false; _writable = true; + _metadataLocked = false; } *************** *** 174,179 **** long result = -1; long newSelect; - String titleStr; - RGHypertextView *mainTitleView; if(_writable) --- 175,178 ---- *************** *** 183,191 **** newSelect = strtol(src+strlen(kPictureSelectTag), &next, 10); SetDefaultPictureToIndexed(newSelect); - GetDefaultPicture(titleStr); - - mainTitleView = dynamic_cast<RGHypertextView*>(_dlog->FindViewByID(kPictureSelectMainTitle)); - AssertValidView(mainTitleView); - mainTitleView->SetText(titleStr.c_str()); LoadCurrentPictureProperties(); } --- 182,185 ---- *************** *** 263,269 **** RGBColor bg; String titleStr; - RGHypertextView *mainTitleView; _imagePane = dynamic_cast<CQTImagePane*>(dlog->FindViewByID(kPictureSelectMainPicture)); //new CQTImagePane(NULL, viewInit, kQTPaneDefaults); _imagePane->ScaleToFit(true); bg.red = 0; --- 257,264 ---- RGBColor bg; String titleStr; + _dlog = dlog; _imagePane = dynamic_cast<CQTImagePane*>(dlog->FindViewByID(kPictureSelectMainPicture)); //new CQTImagePane(NULL, viewInit, kQTPaneDefaults); + AssertValidView(_imagePane); _imagePane->ScaleToFit(true); bg.red = 0; *************** *** 274,277 **** --- 269,273 ---- picture = GetDefaultPicture(titleStr); + LoadCurrentPictureProperties(); if(picture != NULL) _imagePane->SetSourceCGWorld(picture); *************** *** 281,289 **** ! mainTitleView = dynamic_cast<RGHypertextView*>(dlog->FindViewByID(kPictureSelectMainTitle)); ! AssertValidView(mainTitleView); ! mainTitleView->SetText(titleStr.c_str()); - _dlog = dlog; RebuildBottomPane(); --- 277,282 ---- ! UpdateTitle(); RebuildBottomPane(); *************** *** 311,315 **** RebuildSupplierMenu(); - LoadCurrentPictureProperties(); HidePanel(); --- 304,307 ---- *************** *** 403,415 **** void PictureSelectDialog::PopupValue(XGDialog *dlog, long /*viewID*/) { - - String titleStr; - RGHypertextView *mainTitleView; - SaveCurrentPictureProperties(); ! GetDefaultPicture(titleStr); ! mainTitleView = dynamic_cast<RGHypertextView*>(dlog->FindViewByID(kPictureSelectMainTitle)); ! AssertValidView(mainTitleView); ! mainTitleView->SetText(titleStr.c_str()); RebuildBottomPane(); } --- 395,400 ---- void PictureSelectDialog::PopupValue(XGDialog *dlog, long /*viewID*/) { SaveCurrentPictureProperties(); ! UpdateTitle(); RebuildBottomPane(); } *************** *** 421,432 **** long PictureSelectDialog::EditChanged(XGDialog *dlog, long /*gadgetID*/) { - String titleStr; - RGHypertextView *mainTitleView; - SaveCurrentPictureProperties(); ! GetDefaultPicture(titleStr); ! mainTitleView = dynamic_cast<RGHypertextView*>(dlog->FindViewByID(kPictureSelectMainTitle)); ! AssertValidView(mainTitleView); ! mainTitleView->SetText(titleStr.c_str()); RebuildBottomPane(); --- 406,411 ---- long PictureSelectDialog::EditChanged(XGDialog *dlog, long /*gadgetID*/) { SaveCurrentPictureProperties(); ! UpdateTitle(); RebuildBottomPane(); *************** *** 461,471 **** XGEditText *textCtl; - RGHypertextView *titleCtl; RGBorderlessIcon*triangle = dynamic_cast<RGBorderlessIcon*>(_dlog->FindViewByID(kPictureDisclosureIcon)); ShowPanel(); - titleCtl = dynamic_cast<RGHypertextView*>(_dlog->FindViewByID(kPictureSelectMainTitle)); - AssertValidView(titleCtl); - titleCtl->SetText(""); textCtl = dynamic_cast<XGEditText*>(_dlog->FindViewByID(kPictureCopyright)); --- 440,447 ---- XGEditText *textCtl; RGBorderlessIcon*triangle = dynamic_cast<RGBorderlessIcon*>(_dlog->FindViewByID(kPictureDisclosureIcon)); + AssertValidView(triangle); ShowPanel(); textCtl = dynamic_cast<XGEditText*>(_dlog->FindViewByID(kPictureCopyright)); *************** *** 477,480 **** --- 453,459 ---- triangle->ShowView(); + SaveCurrentPictureProperties(); + UpdateTitle(); + _pasted = true; *************** *** 507,510 **** --- 486,490 ---- String choiceName; + AssertValidView(pop); pop->DeleteAll(); pop->Append(stx("(None)")); *************** *** 528,531 **** --- 508,513 ---- { XGPopControl *pop = dynamic_cast<XGPopControl*>(_dlog->FindViewByID(kPictureSupplier)); + + AssertValidView(pop); long curIndex = pop->GetValue()-2; if(curIndex != index) *************** *** 542,545 **** --- 524,529 ---- RGBorderlessIcon *triangle = dynamic_cast<RGBorderlessIcon*>(_dlog->FindViewByID(kPictureDisclosureIcon)); + AssertValidView(expansion); + AssertValidView(triangle); SetGadgetState(kPictureCopyright, false); SetGadgetState(kPictureCommon, false); *************** *** 560,563 **** --- 544,549 ---- RGBorderlessIcon *triangle = dynamic_cast<RGBorderlessIcon*>(_dlog->FindViewByID(kPictureDisclosureIcon)); + AssertValidView(expansion); + AssertValidView(triangle); SetGadgetState(kPictureCopyright, true); SetGadgetState(kPictureCommon, true); *************** *** 587,598 **** --- 573,587 ---- { textCtl = dynamic_cast<XGEditText*>(_dlog->FindViewByID(kPictureCopyright)); + AssertValidView(textCtl); textCtl->GetTitle(textBuf); copyright = textBuf; textCtl = dynamic_cast<XGEditText*>(_dlog->FindViewByID(kPictureCommon)); + AssertValidView(textCtl); textCtl->GetTitle(textBuf); title = textBuf; textCtl = dynamic_cast<XGEditText*>(_dlog->FindViewByID(kPictureCreator)); + AssertValidView(textCtl); textCtl->GetTitle(textBuf); author = textBuf; *************** *** 601,604 **** --- 590,594 ---- long index; + AssertValidView(popCtl); index = popCtl->GetValue(); if(index < 2) *************** *** 626,629 **** --- 616,620 ---- { XGEditText *textCtl; + RGDisclosureView *expansion = dynamic_cast<RGDisclosureView*>(_dlog->FindViewByID(kPictureDisclosurePane)); long locationChoice; String title, copyright, creator; *************** *** 632,642 **** --- 623,644 ---- textCtl = dynamic_cast<XGEditText*>(_dlog->FindViewByID(kPictureCopyright)); + AssertValidView(textCtl); textCtl->SetTitle(copyright.c_str()); textCtl = dynamic_cast<XGEditText*>(_dlog->FindViewByID(kPictureCommon)); + AssertValidView(textCtl); textCtl->SetTitle(title.c_str()); textCtl = dynamic_cast<XGEditText*>(_dlog->FindViewByID(kPictureCreator)); + AssertValidView(textCtl); textCtl->SetTitle(creator.c_str()); + _metadataLocked = IsMetadataLocked(); + + bool visible = expansion->IsShown(); + SetGadgetState(kPictureCopyright, visible); + SetGadgetState(kPictureCommon, visible); + SetGadgetState(kPictureCreator, visible); + SetLocationMenuToMatch(locationChoice); + UpdateTitle(); } *************** *** 648,652 **** { view->ShowView(); ! if(_writable) view->EnableView(); else --- 650,654 ---- { view->ShowView(); ! if(_writable && !_metadataLocked) view->EnableView(); else *************** *** 657,658 **** --- 659,670 ---- } + void PictureSelectDialog::UpdateTitle() + { + RGHypertextView *mainTitleView; + String titleStr; + GetDefaultPicture(titleStr); + + mainTitleView = dynamic_cast<RGHypertextView*>(_dlog->FindViewByID(kPictureSelectMainTitle)); + AssertValidView(mainTitleView); + mainTitleView->SetText(titleStr.c_str()); + } Index: PictureSelectDialog.h =================================================================== RCS file: /cvsroot/igarden/CommonSource/YAAFExtensions/PictureSelectDialog.h,v retrieving revision 1.9.2.2 retrieving revision 1.9.2.3 diff -C2 -d -r1.9.2.2 -r1.9.2.3 *** PictureSelectDialog.h 12 Apr 2008 19:02:16 -0000 1.9.2.2 --- PictureSelectDialog.h 12 Apr 2008 21:24:13 -0000 1.9.2.3 *************** *** 62,65 **** --- 62,66 ---- virtual void GetDefaultPictureProperties(String &title, String ©right, String &creator, long &locationChoice) = 0; virtual long CreateLocationChoice() = 0; + virtual bool IsMetadataLocked() = 0; virtual long NumLocationChoices(); virtual void GetIndexedLocationChoiceName(long index, String &name); *************** *** 73,83 **** void SetLocationMenuToMatch(long index); void SetReadOnly(bool readOnly); ! ! private: ! static dialogCBResult_t Eventhandler(XGDialog *d, class RGDialog *rgd,long msg,long arg,void *parg, void *callbackContext); void SaveCurrentPictureProperties(); void LoadCurrentPictureProperties(); void SetGadgetState(long id, bool visible); XGDialog *_dlog; CQTImagePane *_imagePane; --- 74,85 ---- void SetLocationMenuToMatch(long index); void SetReadOnly(bool readOnly); ! void UpdateTitle(); void SaveCurrentPictureProperties(); void LoadCurrentPictureProperties(); void SetGadgetState(long id, bool visible); + private: + static dialogCBResult_t Eventhandler(XGDialog *d, class RGDialog *rgd,long msg,long arg,void *parg, void *callbackContext); + XGDialog *_dlog; CQTImagePane *_imagePane; *************** *** 86,89 **** --- 88,92 ---- bool _pasted; bool _writable; + bool _metadataLocked; }; |