[Igarden-commit] CommonSource/YAAFExtensions PictureSelectDialog.h, 1.9, 1.9.2.1 RGTableView.cpp, 1
Status: Beta
Brought to you by:
jlbedell
|
From: Jeffrey B. <jlb...@us...> - 2008-04-11 10:26:12
|
Update of /cvsroot/igarden/CommonSource/YAAFExtensions In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv24728/YAAFExtensions Modified Files: Tag: Release_branch_v1 PictureSelectDialog.h RGTableView.cpp PictureSelectDialog.cpp Log Message: If column set is read-only, then open a read-only version of the picture selection dialog Rcalculate scroll parameters when column set changes Index: PictureSelectDialog.cpp =================================================================== RCS file: /cvsroot/igarden/CommonSource/YAAFExtensions/PictureSelectDialog.cpp,v retrieving revision 1.13.2.4 retrieving revision 1.13.2.5 diff -C2 -d -r1.13.2.4 -r1.13.2.5 *** PictureSelectDialog.cpp 19 Mar 2008 01:09:36 -0000 1.13.2.4 --- PictureSelectDialog.cpp 11 Apr 2008 10:25:58 -0000 1.13.2.5 *************** *** 71,74 **** --- 71,75 ---- _parentCallback = parent; _pasted = false; + _writable = true; } *************** *** 103,129 **** AssertValidView(scrollView); ! numOptions = GetNumPictures(); ! for(n = 0, text=""; n < numOptions; n++) { ! GetPicture(n, oneItem); ! text += oneItem; ! ! requiredLen = strlen(template3) + strlen(kPictureSelectTag) + 12; ! bufPtr = new char[requiredLen]; ! yformat(bufPtr, template3, kPictureSelectTag, n); ! text += bufPtr; ! delete [] bufPtr; ! ! text += "<br><hr>"; ! } ! if(CanLoadMorePictures()) ! { ! requiredLen = strlen(template4) + strlen(kPictureLoadTag); ! bufPtr = new char[requiredLen]; ! yformat(bufPtr, template4, kPictureLoadTag); ! text += bufPtr; ! delete [] bufPtr; } - displayView->SetText(text.c_str()); --- 104,132 ---- AssertValidView(scrollView); ! if(_writable) { ! numOptions = GetNumPictures(); ! for(n = 0, text=""; n < numOptions; n++) ! { ! GetPicture(n, oneItem); ! text += oneItem; ! ! requiredLen = strlen(template3) + strlen(kPictureSelectTag) + 12; ! bufPtr = new char[requiredLen]; ! yformat(bufPtr, template3, kPictureSelectTag, n); ! text += bufPtr; ! delete [] bufPtr; ! ! text += "<br><hr>"; ! } ! if(CanLoadMorePictures()) ! { ! requiredLen = strlen(template4) + strlen(kPictureLoadTag); ! bufPtr = new char[requiredLen]; ! yformat(bufPtr, template4, kPictureLoadTag); ! text += bufPtr; ! delete [] bufPtr; ! } } displayView->SetText(text.c_str()); *************** *** 135,139 **** textRect.left = textPos.h; if(textHeight < textSize.v) ! textHeight = textSize.v; textRect.bottom = textRect.top + textHeight; textRect.right = textRect.left + textSize.h; --- 138,142 ---- textRect.left = textPos.h; if(textHeight < textSize.v) ! textHeight = textSize.v; textRect.bottom = textRect.top + textHeight; textRect.right = textRect.left + textSize.h; *************** *** 147,150 **** --- 150,158 ---- } + void PictureSelectDialog::SetReadOnly(bool readOnly) + { + _writable = !readOnly; + } + #pragma mark PictureSelect *************** *** 167,201 **** RGHypertextView *mainTitleView; ! if(CIstrncmp(src, kPictureSelectTag, strlen(kPictureSelectTag)) == 0) ! { ! 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()); ! } ! else if(CIstrncmp(src, kPictureLoadTag, strlen(kPictureLoadTag)) == 0) ! { ! LoadAllPictures(); ! RebuildBottomPane(); ! } ! else { ! if(CIstrncmp(src, "http://", 7) == 0) ! strcpy(linkCopy, src); else { ! strcpy(linkCopy, "http://"); ! strcat(linkCopy, src); } - url = new CInternetConfig(RSGrdenCreator); // test application signature - url->Start(); - yaaf::cvtc2p(linkCopy); - (void)url->DoURL((unsigned char*)linkCopy); - delete url; - result = 0; } return result; --- 175,214 ---- RGHypertextView *mainTitleView; ! if(_writable) { ! if(CIstrncmp(src, kPictureSelectTag, strlen(kPictureSelectTag)) == 0) ! { ! 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()); ! } ! else if(CIstrncmp(src, kPictureLoadTag, strlen(kPictureLoadTag)) == 0) ! { ! LoadAllPictures(); ! RebuildBottomPane(); ! } else { ! if(CIstrncmp(src, "http://", 7) == 0) ! strcpy(linkCopy, src); ! else ! { ! strcpy(linkCopy, "http://"); ! strcat(linkCopy, src); ! } ! url = new CInternetConfig(RSGrdenCreator); // test application signature ! url->Start(); ! yaaf::cvtc2p(linkCopy); ! (void)url->DoURL((unsigned char*)linkCopy); ! delete url; ! result = 0; } } + else + XGBeep(); return result; *************** *** 274,277 **** --- 287,301 ---- triangle->HideView(); + if(_writable) + { + dlog->FindViewByID(2)->ShowView(); + dlog->SetTitle(stx("Picture Selection")); + } + else + { + dlog->FindViewByID(2)->HideView(); + dlog->SetTitle(stx("Picture Display")); + } + RebuildSupplierMenu(); *************** *** 298,312 **** String title, copyright; ! textCtl = dynamic_cast<XGEditText*>(dlog->FindViewByID(kPictureCopyright)); ! textCtl->GetTitle(textBuf); ! copyright = textBuf; ! ! textCtl = dynamic_cast<XGEditText*>(dlog->FindViewByID(kPictureCommon)); ! textCtl->GetTitle(textBuf); ! title = textBuf; ! SaveDefaultPictureProperties(title, copyright); - // Exit(1); XGBroadcast::RemoveBroadcast(_dlog); --- 322,340 ---- String title, copyright; ! if(_writable) ! { ! textCtl = dynamic_cast<XGEditText*>(dlog->FindViewByID(kPictureCopyright)); ! textCtl->GetTitle(textBuf); ! copyright = textBuf; ! ! textCtl = dynamic_cast<XGEditText*>(dlog->FindViewByID(kPictureCommon)); ! textCtl->GetTitle(textBuf); ! title = textBuf; ! SaveDefaultPictureProperties(title, copyright); ! ! // Exit(1); ! } XGBroadcast::RemoveBroadcast(_dlog); *************** *** 345,349 **** RGClipboard *clip = RGClipboard::GetClipboard(); ! if(clip->PictureKind() != kNotAPicture) { m->enable = true; --- 373,377 ---- RGClipboard *clip = RGClipboard::GetClipboard(); ! if(_writable && clip->PictureKind() != kNotAPicture) { m->enable = true; *************** *** 364,368 **** { case KXGEditPaste: ! HandlePaste(); return 0; break; --- 392,397 ---- { case KXGEditPaste: ! if(_writable) ! HandlePaste(); return 0; break; *************** *** 450,453 **** --- 479,483 ---- RGBorderlessIcon *triangle = dynamic_cast<RGBorderlessIcon*>(_dlog->FindViewByID(kPictureDisclosureIcon)); PRECONDITION(triangle != NULL); + PRECONDITION(_writable); triangle->ShowView(); *************** *** 543,550 **** void PictureSelectDialog::ShowPanel() { ! _dlog->FindViewByID(kPictureCopyright)->ShowView(); ! _dlog->FindViewByID(kPictureCommon)->ShowView(); if(NumLocationChoices() != 0) ! _dlog->FindViewByID(kPictureSupplier)->ShowView(); // _dlog->FindViewByID(kPictureWebSite)->ShowView(); } --- 573,599 ---- void PictureSelectDialog::ShowPanel() { ! XGView *view; ! ! view = _dlog->FindViewByID(kPictureCopyright); ! view->ShowView(); ! if(_writable) ! view->EnableView(); ! else ! view->DisableView(); ! ! view = _dlog->FindViewByID(kPictureCommon); ! if(_writable) ! view->EnableView(); ! else ! view->DisableView(); ! if(NumLocationChoices() != 0) ! { ! view = _dlog->FindViewByID(kPictureSupplier); ! if(_writable) ! view->EnableView(); ! else ! view->DisableView(); ! } // _dlog->FindViewByID(kPictureWebSite)->ShowView(); } Index: PictureSelectDialog.h =================================================================== RCS file: /cvsroot/igarden/CommonSource/YAAFExtensions/PictureSelectDialog.h,v retrieving revision 1.9 retrieving revision 1.9.2.1 diff -C2 -d -r1.9 -r1.9.2.1 *** PictureSelectDialog.h 9 Feb 2006 13:41:09 -0000 1.9 --- PictureSelectDialog.h 11 Apr 2008 10:25:58 -0000 1.9.2.1 *************** *** 71,74 **** --- 71,75 ---- void RebuildSupplierMenu(); void SetLocationMenuToMatch(long index); + void SetReadOnly(bool readOnly); private: *************** *** 80,83 **** --- 81,85 ---- void *_parentCallback; bool _pasted; + bool _writable; }; Index: RGTableView.cpp =================================================================== RCS file: /cvsroot/igarden/CommonSource/YAAFExtensions/RGTableView.cpp,v retrieving revision 1.28.2.35 retrieving revision 1.28.2.36 diff -C2 -d -r1.28.2.35 -r1.28.2.36 *** RGTableView.cpp 9 Apr 2008 03:36:52 -0000 1.28.2.35 --- RGTableView.cpp 11 Apr 2008 10:25:58 -0000 1.28.2.36 *************** *** 391,400 **** ColRecord *column = _colArray[selCol]; ! if(!_rowArray[selRow]->forceWritable || (cell != NULL && cell->GetType() == KTypeIcon)) { ! if ((column->display == true) || (cell != NULL && (cell->IsReadOnly() || cell->GetType() == KTypeIcon))) ! { ! SetSelectRow(selRow); ! return false; } } --- 391,403 ---- ColRecord *column = _colArray[selCol]; ! if(cell->GetType() != KTypePicture) // Always open picture type, as it can't be seen otehrwise { ! if(!_rowArray[selRow]->forceWritable || (cell != NULL && cell->GetType() == KTypeIcon)) ! { ! if ((column->display == true) || (cell != NULL && (cell->IsReadOnly() || cell->GetType() == KTypeIcon))) ! { ! SetSelectRow(selRow); ! return false; ! } } } *************** *** 655,662 **** h = draw.GetFontHeight(); if (_colArray.Length() >= 1) { ! ct = _colArray.Length() - 1; ! x = _colArray[ct]->origin + _colArray[ct]->width; } else --- 658,672 ---- h = draw.GetFontHeight(); + RecalcWidth(); if (_colArray.Length() >= 1) { ! for(ct = _colArray.Length() - 1; ct >= 0; ct--) ! { ! if(_colArray[ct]->visible) ! { ! x = _colArray[ct]->origin + _colArray[ct]->width; ! break; ! } ! } } else |