[Rezilla-commits] RezillaSource/Rezilla_Src/Editors/Edit_ICNS CICNS_EditorWindow.cp,1.1,1.2 CICNS_Ed
Brought to you by:
bdesgraupes
From: Bernard D. <bde...@us...> - 2006-02-26 11:57:30
|
Update of /cvsroot/rezilla/RezillaSource/Rezilla_Src/Editors/Edit_ICNS In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19680 Modified Files: CICNS_EditorWindow.cp CICNS_EditorWindow.h Log Message: Completed first impl Index: CICNS_EditorWindow.cp =================================================================== RCS file: /cvsroot/rezilla/RezillaSource/Rezilla_Src/Editors/Edit_ICNS/CICNS_EditorWindow.cp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- CICNS_EditorWindow.cp 25 Feb 2006 21:53:48 -0000 1.1 +++ CICNS_EditorWindow.cp 26 Feb 2006 11:57:23 -0000 1.2 @@ -2,7 +2,7 @@ // CICNS_EditorWindow.cp // // Created: 2006-02-23 15:12:16 -// Last modification: 2006-02-23 15:12:20 +// Last modification: 2006-02-25 20:51:14 // Author: Bernard Desgraupes // e-mail: <bde...@us...> // www: <http://rezilla.sourceforge.net/> @@ -12,7 +12,8 @@ #include "CICNS_EditorDoc.h" #include "CICNS_EditorWindow.h" -#include "CIndexedEditField.h" +#include "CICNS_Family.h" +#include "CICNS_Stream.h" #include "CRezObj.h" #include "RezillaConstants.h" #include "UMessageDialogs.h" @@ -24,8 +25,9 @@ #include <stdio.h> -SPaneInfo CICNS_EditorWindow::sPaneInfo; -SViewInfo CICNS_EditorWindow::sViewInfo; +// SPaneInfo CICNS_EditorWindow::sPaneInfo; +// SViewInfo CICNS_EditorWindow::sViewInfo; + // --------------------------------------------------------------------------- // CICNS_EditorWindow [public] @@ -106,27 +108,25 @@ mContentsView = dynamic_cast<LView *>(this->FindPaneByID(item_EditorContents)); ThrowIfNil_( mContentsView ); -// mTGV = dynamic_cast<LTabGroupView *>(this->FindPaneByID( item_TabGroup )); -// ThrowIfNil_( mTGV ); - // View info - sViewInfo.imageSize.width = sViewInfo.imageSize.height = 0 ; - sViewInfo.scrollPos.h = sViewInfo.scrollPos.v = 0; - sViewInfo.scrollUnit.h = sViewInfo.scrollUnit.v = kStrxHeight; - sViewInfo.reconcileOverhang = false; - - // Pane info - sPaneInfo.left = 0; - sPaneInfo.height = kStrxHeight; - sPaneInfo.visible = true; - sPaneInfo.enabled = true; - sPaneInfo.bindings.left = true; - sPaneInfo.bindings.top = false; - sPaneInfo.bindings.right = true; - sPaneInfo.bindings.bottom = false; - sPaneInfo.userCon = 0; - sPaneInfo.paneID = 0; - sPaneInfo.superView = mContentsView; +// // View info +// sViewInfo.imageSize.width = sViewInfo.imageSize.height = 0 ; +// sViewInfo.scrollPos.h = sViewInfo.scrollPos.v = 0; +// sViewInfo.scrollUnit.h = sViewInfo.scrollUnit.v = kStrxHeight; +// sViewInfo.reconcileOverhang = false; +// +// // Pane info +// sPaneInfo.left = 0; +// sPaneInfo.height = kStrxHeight; +// sPaneInfo.visible = true; +// sPaneInfo.enabled = true; +// sPaneInfo.bindings.left = true; +// sPaneInfo.bindings.top = false; +// sPaneInfo.bindings.right = true; +// sPaneInfo.bindings.bottom = false; +// sPaneInfo.userCon = 0; +// sPaneInfo.paneID = 0; +// sPaneInfo.superView = mContentsView; // Link the broadcasters UReanimator::LinkListenerToControls( this, this, PPob_MenuEditorWindow ); @@ -170,18 +170,7 @@ switch (inMessage) { case msg_MinusButton: { - if (mIndexedFields.GetCount() == 0) {return;} - if (DeleteSelectedItems() > 0) { - RecalcAllPositions(); - } else { - // If no item selected, delete the last one - CIndexedEditField * theField; - if ( mIndexedFields.FetchItemAt(mIndexedFields.GetCount(), theField) ) { - theField->Hide(); - mIndexedFields.RemoveItemsAt(1, mIndexedFields.GetCount()); - } - } - mContentsView->ResizeImageTo(0, mIndexedFields.GetCount() * kStrxHeight, false); + SetDirty(true); Refresh(); break; @@ -189,16 +178,8 @@ case msg_PlusButton: { - UInt16 index = GetFirstSelected(); - SInt32 theVal = 1; - if ( ::GetCurrentEventKeyModifiers() & optionKey) { - if ( ! UMessageDialogs::GetOneValue(this, CFSTR("HowManyItems"), PPob_GetValueDialog, - item_PromptField, item_ValueField, theVal) - || theVal == 0) { - return; - } - } - CreateItemAtIndex(index, "\p", theVal); + + CreateIconAtIndex( 0 ); SetDirty(true); break; } @@ -218,111 +199,8 @@ // --------------------------------------------------------------------------- -// FindCommandStatus -// --------------------------------------------------------------------------- - -void -CICNS_EditorWindow::FindCommandStatus( - CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - UInt16 &outMark, - Str255 outName) -{ - switch (inCommand) { - - default: - CEditorWindow::FindCommandStatus(inCommand, outEnabled, - outUsesMark, outMark, outName); - break; - } -} - - -// --------------------------------------------------------------------------- -// ObeyCommand [public, virtual] -// --------------------------------------------------------------------------- - -Boolean -CICNS_EditorWindow::ObeyCommand( - CommandT inCommand, - void* ioParam) -{ - Boolean cmdHandled = true; - - switch (inCommand) { - - default: - cmdHandled = LCommander::ObeyCommand(inCommand, ioParam); - break; - } - - return cmdHandled; -} - - -// --------------------------------------------------------------------------- -// HandleKeyPress [public] -// --------------------------------------------------------------------------- -// Tab switches the Target to the next edit field in the window, Shift-Tab -// to the previous item. All other keystrokes are ignored. - -Boolean -CICNS_EditorWindow::HandleKeyPress( - const EventRecord& inKeyEvent) -{ - Boolean keyHandled = true; - UInt16 theChar = (UInt16) (inKeyEvent.message & charCodeMask); - - if (theChar == char_Tab) { - ArrayIndexT index; - CIndexedEditField * theField; - LCommander * currTabTarget = GetTarget(); - - if (currTabTarget == nil) { - index = 1; - } else { - LEditText * theEditText = dynamic_cast<LEditText *>(currTabTarget); - if (theEditText != nil) { - theField = dynamic_cast<CIndexedEditField *>(theEditText->GetSuperView());; - // Find the index of the field - index = mIndexedFields.FetchIndexOf(theField); - if (index != LArray::index_Bad) { - // Switch to next index (if shift, go backwards) - if ((inKeyEvent.modifiers & shiftKey) != 0) { - if (index == 1) { - index = mIndexedFields.GetCount(); - } else { - index--; - } - } else { - if (index == mIndexedFields.GetCount()) { - index = 1; - } else { - index++; - } - } - } - } - } - if ( mIndexedFields.FetchItemAt(index, theField) ) { - SwitchTarget(theField->GetEditText()); - } - } - - return keyHandled; -} - - -// --------------------------------------------------------------------------- // InstallResourceData [public] // --------------------------------------------------------------------------- -// ITML RSID (eq DWRD) -// MBAR DWRD -// RID# DWRD -// Mcmd DLNG -// RidL DLNG -// typ# TNAM OSErr CICNS_EditorWindow::InstallResourceData(Handle inHandle) @@ -331,7 +209,7 @@ UInt16 numItems = 0; StHandleLocker locker(inHandle); - LHandleStream * theStream = new LHandleStream(inHandle); + CICNS_Stream * theStream = new CICNS_Stream(inHandle); if ( theStream->GetLength() == 0 ) { // We are creating a new resource @@ -339,29 +217,8 @@ *theStream >> numItems; for (UInt16 i = 1; i <= numItems; i++) { - Str255 theString; - SInt16 theSInt16; - long theLong; - if ( theStream->GetMarker() < theStream->GetLength() ) { - switch (mOwnerDoc->GetSubstType()) { - case 'STR#': - *theStream >> theString; - break; - - case 'MBAR': - *theStream >> theSInt16; - ::NumToString( (long) theSInt16, theString); - break; - - case 'Mcmd': - case 'RidL': - *theStream >> theLong; - ::NumToString( theLong, theString); - break; - - } - AddStringItem(theString); + mIcnsFamily = new CICNS_Family(theStream); } } @@ -374,8 +231,13 @@ delete theStream; if (error == noErr) { +// mContentsView->ResizeImageTo(0, numItems * kStrxHeight, false); +// InstallIcon(1); + } + + if (error == noErr) { // Adjust the size of the image - mContentsView->ResizeImageTo(0, numItems * kStrxHeight, false); +// mContentsView->ResizeImageTo(0, numItems * kStrxHeight, false); SetDirty(false); } @@ -384,228 +246,50 @@ // --------------------------------------------------------------------------- -// AddStringItem [public] -// --------------------------------------------------------------------------- - -void -CICNS_EditorWindow::AddStringItem(Str255 inString) -{ - InsertStringItemAtIndex(0, inString); -} - - -// --------------------------------------------------------------------------- -// CreateItemAtIndex [public] -// --------------------------------------------------------------------------- - -void -CICNS_EditorWindow::CreateItemAtIndex(UInt16 index, Str255 inString, SInt32 inHowMany) -{ - mContentsView->Deactivate(); - mContentsView->Hide(); - for (SInt32 i = 0; i < inHowMany; i++) { - InsertStringItemAtIndex(index, inString); - } - RecalcPositionsInRange(index + 1, mIndexedFields.GetCount()); - mContentsView->ResizeImageTo(0, mIndexedFields.GetCount() * kStrxHeight, false); - mContentsView->Show(); - mContentsView->Enable(); - mContentsView->Activate(); -} - - -// --------------------------------------------------------------------------- -// InsertStringItemAtIndex [public] -// --------------------------------------------------------------------------- - -void -CICNS_EditorWindow::InsertStringItemAtIndex(UInt16 index, Str255 inString) -{ - SDimension16 frameSize; - UInt16 maxIndex = mIndexedFields.GetCount() + 1; - - if (index == 0) { - index = maxIndex; - } - mContentsView->GetFrameSize(frameSize); - - // Pane info - sPaneInfo.top = (index - 1) * kStrxHeight; - sPaneInfo.width = frameSize.width; - - ResType theType = GetOwnerDoc()->GetSubstType(); - SInt16 maxChar; - TEKeyFilterFunc filter; - - switch (mOwnerDoc->GetSubstType()) { - case 'STR#': - maxChar = 255; - filter = UKeyFilters::SelectTEKeyFilter(keyFilter_PrintingCharAndCR); - break; - - case 'MBAR': - case 'Mcmd': - case 'RidL': - maxChar = 6; - filter = UKeyFilters::SelectTEKeyFilter(keyFilter_NegativeInteger); - break; - - } - - CIndexedEditField * theField = new CIndexedEditField(this, sPaneInfo, sViewInfo, index, inString, maxChar, filter); - if (index == maxIndex) { - mIndexedFields.AddItem(theField); - } else { - mIndexedFields.InsertItemsAt(1, index, theField); - } -} - - -// --------------------------------------------------------------------------- -// RecalcPositionAtIndex [private] +// CreateIconAtIndex [public] // --------------------------------------------------------------------------- void -CICNS_EditorWindow::RecalcPositionAtIndex(UInt16 index) +CICNS_EditorWindow::CreateIconAtIndex(UInt16 index) { - CIndexedEditField * theField; - - if ( mIndexedFields.FetchItemAt(index, theField) ) { - SInt32 oldPos, newPos; - Rect theFrame; - - theField->SetIndexField(index); - theField->CalcPortFrameRect(theFrame); - mContentsView->PortToLocalPoint(topLeft(theFrame)); - oldPos = theFrame.top; - newPos = (index - 1) * kStrxHeight; - theField->MoveBy(0, newPos - oldPos, false); - } } // --------------------------------------------------------------------------- -// RecalcAllPositions [private] +// InstallIconAtIndex [private] // --------------------------------------------------------------------------- void -CICNS_EditorWindow::RecalcAllPositions() -{ - RecalcPositionsInRange(1, mIndexedFields.GetCount()); -} +CICNS_EditorWindow::InstallIconAtIndex(UInt16 index) +{} // --------------------------------------------------------------------------- -// RecalcPositionsInRange [private] +// DeleteIconAtIndex [private] // --------------------------------------------------------------------------- -// All indices between inStart and inEnd (inclusive) void -CICNS_EditorWindow::RecalcPositionsInRange(UInt16 inStart, UInt16 inEnd) -{ - if (inStart > inEnd) { - UInt16 pos = inEnd; - inEnd = inStart; - inStart = pos; - } - for (UInt16 i = inStart; i <= inEnd; i++) { - RecalcPositionAtIndex(i); - } -} - - -// --------------------------------------------------------------------------- -// GetFirstSelected [public] -// --------------------------------------------------------------------------- - -UInt16 -CICNS_EditorWindow::GetFirstSelected() -{ - UInt16 result = 0, index = 0; - TArrayIterator<CIndexedEditField*> iterator(mIndexedFields); - CIndexedEditField * theField; - - while (iterator.Next(theField)) { - index++; - if ( theField->IsSelected() ) { - result = index; - break; - } - } - - return result; -} - - -// --------------------------------------------------------------------------- -// DeleteSelectedItems [public] -// --------------------------------------------------------------------------- - -UInt16 -CICNS_EditorWindow::DeleteSelectedItems() -{ - UInt16 count = 0, index; - CIndexedEditField * theField; - - for (index = mIndexedFields.GetCount(); index > 0 ; index--) { - if ( mIndexedFields.FetchItemAt(index, theField) && theField->IsSelected() ) { - // Just hide the pane. Destructor will take care of deleting - // the object when the window is closed. - theField->Hide(); - mIndexedFields.RemoveItemsAt(1, index); - count++; - } - } - - return count; -} +CICNS_EditorWindow::DeleteIconAtIndex(UInt16 index) +{} // --------------------------------------------------------------------------- // CollectResourceData [public] // --------------------------------------------------------------------------- -// Retrieve the contents of the current panel Handle CICNS_EditorWindow::CollectResourceData() { Handle theHandle = NULL; - Str255 theString; - UInt16 numStrings = mIndexedFields.GetCount(); - long theLong; try { if (mOutStream != nil) {delete mOutStream;} - mOutStream = new LHandleStream(); + mOutStream = new CICNS_Stream(); ThrowIfNil_(mOutStream); - *mOutStream << numStrings; - - TArrayIterator<CIndexedEditField*> iterator(mIndexedFields); - CIndexedEditField * theField; - - while (iterator.Next(theField)) { - theField->GetDescriptor(theString); - - switch (mOwnerDoc->GetSubstType()) { - case 'STR#': - *mOutStream << theString; - break; - - case 'MBAR': - ::StringToNum( theString, &theLong); - *mOutStream << (SInt16) theLong; - break; - - case 'Mcmd': - case 'RidL': - ::StringToNum( theString, &theLong); - *mOutStream << theLong; - break; - - } - } + mIcnsFamily->SendDataToStream(mOutStream); + theHandle = mOutStream->GetDataHandle(); } catch (...) { @@ -627,8 +311,8 @@ // Delete the panes mContentsView->DeleteAllSubPanes(); - // Reset the array - mIndexedFields.RemoveAllItemsAfter(0); +// // Reset the array +// mIndexedFields.RemoveAllItemsAfter(0); mContentsView->Hide(); @@ -691,73 +375,73 @@ ItemReference inItemRef, Rect &inItemBounds ) { -#pragma unused( inDragAttrs, inItemBounds ) - - FlavorFlags theFlags; - ThrowIfOSErr_( ::GetFlavorFlags( inDragRef, inItemRef, 'TEXT', &theFlags ) ); - - // Get the data - Size theDataSize = 255; - Str255 theString; - ThrowIfOSErr_( ::GetFlavorData( inDragRef, inItemRef,'TEXT', &theString[1], &theDataSize, 0 ) ); - - // Get the data size and set the string length - ThrowIfOSErr_( ::GetFlavorDataSize( inDragRef, inItemRef, 'TEXT', &theDataSize ) ); - theString[0] = theDataSize; - - if ( UDragAndDropUtils::CheckIfViewIsAlsoSender(inDragRef) ) { - CIndexedEditField * theField; - UInt16 oldRow, oldIndex, newIndex; - - if (!UDragAndDropUtils::CheckForOptionKey(inDragRef) ) { - // No option key, it is a move operation - - // Get the original index - Point thePoint; - ::GetDragOrigin(inDragRef, &thePoint); - GlobalToPortPoint(thePoint); - GetIndexFromPoint(thePoint, oldIndex, oldRow); - - // If item k is dropped on dropIndex k-1 (just above itself) or - // k (just below itself) it means that it remains in its - // original position. - if ( mDropIndex != oldIndex-1 && mDropIndex != oldIndex ) { - // Operate on the fields array - if ( mIndexedFields.FetchItemAt(oldIndex, theField) ) { - // Delete the old data - mIndexedFields.RemoveItemsAt(1, oldIndex); - // Add the new data - if ( mDropIndex == -1 ) { - mIndexedFields.AddItem(theField); - } else { - newIndex = mDropIndex; - if ( newIndex < oldRow ) { - // Adjust for deleted row - newIndex += 1; - } - mIndexedFields.InsertItemsAt(1, newIndex, theField); - } - } - RecalcPositionsInRange(oldIndex, newIndex); - } - } else { - // It is a copy operation - if ( mDropIndex == -1 ) { - newIndex = 0; - } else { - newIndex = mDropIndex + 1; - } - CreateItemAtIndex(newIndex, theString, 1); - RecalcPositionsInRange(newIndex + 1, mIndexedFields.GetCount()); - } - } else { - // The drag comes from outside - CreateItemAtIndex(mDropIndex + 1, theString, 1); - RecalcPositionsInRange(mDropIndex + 1, mIndexedFields.GetCount()); - } - - Refresh(); - SetDirty(true); +// #pragma unused( inDragAttrs, inItemBounds ) +// +// FlavorFlags theFlags; +// ThrowIfOSErr_( ::GetFlavorFlags( inDragRef, inItemRef, 'TEXT', &theFlags ) ); +// +// // Get the data +// Size theDataSize = 255; +// Str255 theString; +// ThrowIfOSErr_( ::GetFlavorData( inDragRef, inItemRef,'TEXT', &theString[1], &theDataSize, 0 ) ); +// +// // Get the data size and set the string length +// ThrowIfOSErr_( ::GetFlavorDataSize( inDragRef, inItemRef, 'TEXT', &theDataSize ) ); +// theString[0] = theDataSize; +// +// if ( UDragAndDropUtils::CheckIfViewIsAlsoSender(inDragRef) ) { +// CIndexedEditField * theField; +// UInt16 oldRow, oldIndex, newIndex; +// +// if (!UDragAndDropUtils::CheckForOptionKey(inDragRef) ) { +// // No option key, it is a move operation +// +// // Get the original index +// Point thePoint; +// ::GetDragOrigin(inDragRef, &thePoint); +// GlobalToPortPoint(thePoint); +// GetIndexFromPoint(thePoint, oldIndex, oldRow); +// +// // If item k is dropped on dropIndex k-1 (just above itself) or +// // k (just below itself) it means that it remains in its +// // original position. +// if ( mDropIndex != oldIndex-1 && mDropIndex != oldIndex ) { +// // Operate on the fields array +// if ( mIndexedFields.FetchItemAt(oldIndex, theField) ) { +// // Delete the old data +// mIndexedFields.RemoveItemsAt(1, oldIndex); +// // Add the new data +// if ( mDropIndex == -1 ) { +// mIndexedFields.AddItem(theField); +// } else { +// newIndex = mDropIndex; +// if ( newIndex < oldRow ) { +// // Adjust for deleted row +// newIndex += 1; +// } +// mIndexedFields.InsertItemsAt(1, newIndex, theField); +// } +// } +// RecalcPositionsInRange(oldIndex, newIndex); +// } +// } else { +// // It is a copy operation +// if ( mDropIndex == -1 ) { +// newIndex = 0; +// } else { +// newIndex = mDropIndex + 1; +// } +// CreateItemAtIndex(newIndex, theString, 1); +// RecalcPositionsInRange(newIndex + 1, mIndexedFields.GetCount()); +// } +// } else { +// // The drag comes from outside +// CreateItemAtIndex(mDropIndex + 1, theString, 1); +// RecalcPositionsInRange(mDropIndex + 1, mIndexedFields.GetCount()); +// } +// +// Refresh(); +// SetDirty(true); } @@ -785,8 +469,8 @@ CICNS_EditorWindow::LeaveDropArea( DragReference inDragRef ) { - // Undo dividing line drawing - DrawDividingLine( mDropIndex ); +// // Undo dividing line drawing +// DrawDividingLine( mDropIndex ); // Invalidate the last drop index mDropIndex = -1; // Call inherited @@ -808,28 +492,28 @@ // Call inherited LDragAndDrop::InsideDropArea( inDragRef ); - if ( FocusDraw() ) { - - // Get the mouse location and convert to port coordinates - Point thePoint; - ::GetDragMouse( inDragRef, &thePoint, nil ); - GlobalToPortPoint( thePoint ); - - // Get the dividing line point - UInt16 theItemIndex, theDropIndex; - GetIndexFromPoint( thePoint, theItemIndex, theDropIndex ); - - if ( mDropIndex != theDropIndex ) { - if ( mDropIndex >= 0 ) { - // Undo the previous line (drawing uses patXor mode) - DrawDividingLine( mDropIndex ); - } - - // Update the drop index and draw the new dividing line - mDropIndex = theDropIndex; - DrawDividingLine( mDropIndex ); - } - } +// if ( FocusDraw() ) { +// +// // Get the mouse location and convert to port coordinates +// Point thePoint; +// ::GetDragMouse( inDragRef, &thePoint, nil ); +// GlobalToPortPoint( thePoint ); +// +// // Get the dividing line point +// UInt16 theItemIndex, theDropIndex; +// GetIndexFromPoint( thePoint, theItemIndex, theDropIndex ); +// +// if ( mDropIndex != theDropIndex ) { +// if ( mDropIndex >= 0 ) { +// // Undo the previous line (drawing uses patXor mode) +// DrawDividingLine( mDropIndex ); +// } +// +// // Update the drop index and draw the new dividing line +// mDropIndex = theDropIndex; +// DrawDividingLine( mDropIndex ); +// } +// } } @@ -853,86 +537,3 @@ } -// --------------------------------------------------------------------------------- -// GetIndexFromPoint -// --------------------------------------------------------------------------------- -// One must distinguish the index of the item in the list and the drop -// index. On output, outItemIndex gives the real index of the item in the -// list (between 1 and n) and outDropRow gives the drop index (between 0 -// and n). The drop index tells where to draw the dividing line and where -// to insert the item. - -void -CICNS_EditorWindow::GetIndexFromPoint( - const Point &inPortPoint, - UInt16 &outItemIndex, - UInt16 &outDropRow ) -{ - // Convert to local coordinates - Point theLocalPoint = inPortPoint; - mContentsView->PortToLocalPoint( theLocalPoint ); - - // Convert to image coordinates - SPoint32 theImagePoint; - mContentsView->LocalToImagePoint( theLocalPoint, theImagePoint ); - - // Calculate the item index given the image point - outItemIndex = (theImagePoint.v - 1) / kStrxHeight + 1; - outDropRow = outItemIndex; - - // Calculate the item's midpoint - SInt32 theMidPoint = (outItemIndex - 1) * kStrxHeight + kStrxHeight / 2; - - if ( theImagePoint.v < theMidPoint ) { - // The point is less than the midpoint, so use the previous index - outDropRow -= 1; - } - - // Constrain to the range of items (0 means "insert at the beginning") - if ( outDropRow < 0 ) { - outDropRow = 0; - } else if ( outDropRow > mIndexedFields.GetCount() ) { - outDropRow = mIndexedFields.GetCount(); - } -} - - -// --------------------------------------------------------------------------------- -// DrawDividingLine -// --------------------------------------------------------------------------------- - -void -CICNS_EditorWindow::DrawDividingLine( UInt16 inRow ) -{ - if (inRow == -1) {return;} - - // Focus the pane and get the table and cell frames - Rect theFrame; - - if ( FocusDraw() && mContentsView->CalcPortFrameRect(theFrame) ) { - // Save the draw state - StColorPenState theDrawState; - - // Save the clip region state and clip the list view rect - StClipRgnState theClipState( theFrame ); - - // Setup the color and pen state - ::ForeColor( blackColor ); - ::PenMode( patXor ); - ::PenSize( 2, 2 ); - - // Calculate the dividing line position + theFrame.top - SPoint32 theImagePoint; - Point thePoint; - theImagePoint.v = inRow * kStrxHeight; - theImagePoint.h = theFrame.left + kStrxIndexWidth; - - mContentsView->ImageToLocalPoint(theImagePoint, thePoint); - mContentsView->LocalToPortPoint(thePoint); - - // Draw the line - ::MoveTo( thePoint.h, thePoint.v ); - ::LineTo( thePoint.h + theFrame.right - theFrame.left - kStrxIndexWidth, thePoint.v ); - } -} - Index: CICNS_EditorWindow.h =================================================================== RCS file: /cvsroot/rezilla/RezillaSource/Rezilla_Src/Editors/Edit_ICNS/CICNS_EditorWindow.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- CICNS_EditorWindow.h 25 Feb 2006 21:53:48 -0000 1.1 +++ CICNS_EditorWindow.h 26 Feb 2006 11:57:23 -0000 1.2 @@ -17,11 +17,10 @@ #include <LDragAndDrop.h> -class CIndexedEditField; -class LEditText; -class LStaticText; -class LHandleStream; -/* class LTabGroupView; */ + +class LView; +class CICNS_Stream; +class CICNS_Family; class CICNS_EditorWindow : public CEditorWindow, @@ -40,36 +39,19 @@ virtual void ListenToMessage( MessageT inMessage,void *ioParam); - virtual void FindCommandStatus( - CommandT inCommand, - Boolean& outEnabled, - Boolean& outUsesMark, - UInt16& outMark, - Str255 outName); - - virtual Boolean ObeyCommand( - CommandT inCommand, - void* ioParam); - - virtual Boolean HandleKeyPress( const EventRecord& inKeyEvent ); - OSErr InstallResourceData(Handle inHandle); Handle CollectResourceData(); virtual void RevertContents(); - - UInt16 GetFirstSelected(); LView* GetContentsView() const { return mContentsView;} - static SPaneInfo sPaneInfo; - static SViewInfo sViewInfo; - + protected: - LHandleStream * mOutStream; - LView * mContentsView; - TArray<CIndexedEditField*> mIndexedFields; - UInt16 mDropIndex; + CICNS_Stream * mOutStream; + LView * mContentsView; + CICNS_Family * mIcnsFamily; + UInt16 mDropIndex; virtual void FinishCreateSelf(); @@ -83,23 +65,12 @@ virtual void InsideDropArea( DragReference inDragRef); virtual void HiliteDropArea( DragReference inDragRef ); - void GetIndexFromPoint( - const Point &inPortPoint, - UInt16 &outItemIndex, - UInt16 &outDropRow ); - - void DrawDividingLine( UInt16 inRow ); -private: - void AddStringItem(Str255 inString); - void InsertStringItemAtIndex(UInt16 index, Str255 inString); - void CreateItemAtIndex(UInt16 index, Str255 inString, SInt32 inHowMany); - UInt16 DeleteSelectedItems(); - - void RecalcPositionsInRange(UInt16 inStart, UInt16 inEnd); - void RecalcPositionAtIndex(UInt16 index); - void RecalcAllPositions(); +private: + void CreateIconAtIndex(UInt16 index); + void InstallIconAtIndex(UInt16 index); + void DeleteIconAtIndex(UInt16 index); }; |