[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]
[XaraXtreme-commits] Commit Complete
Commit by : alex
Repository : xara
Revision : 1526
Date : Tue Jul 25 14:32:09 BST 2006
Changed paths:
M /Trunk/XaraLX/Kernel/opfeathr.cpp
M /Trunk/XaraLX/Kernel/opfeathr.h
M /Trunk/XaraLX/wxOil/dlgmgr.cpp
M /Trunk/XaraLX/wxOil/dlgmgr.h
M /Trunk/XaraLX/wxXtra/framemanager.cpp
M /Trunk/XaraLX/wxXtra/framemanager.h
Galleries now remember their positions (but not their size), and only during the session
Diff:
Index: Trunk/XaraLX/Kernel/opfeathr.h
===================================================================
--- Trunk/XaraLX/Kernel/opfeathr.h (revision 1525)
+++ Trunk/XaraLX/Kernel/opfeathr.h (revision 1526)
@@ -228,6 +228,8 @@
virtual void DoSlide(INT32 SlideValue);
virtual void SlideFinished(BOOL SuccessfulFinish = TRUE);
+ static BOOL IsUpdateDisabled() {return s_DisableUpdates;}
+
private:
#ifdef FEATHER_EFFECT
static NodeFeatherEffect* DoReplaceFeatherEffectNode(UndoableOperation* pOp,
@@ -239,8 +241,9 @@
private:
List m_NewFeatherAttrs;
- static INT32 s_iEditStackPos;
+ static INT32 s_iEditStackPos;
static ListRange* s_pEditRange;
+ static BOOL s_DisableUpdates;
};
Index: Trunk/XaraLX/Kernel/opfeathr.cpp
===================================================================
--- Trunk/XaraLX/Kernel/opfeathr.cpp (revision 1525)
+++ Trunk/XaraLX/Kernel/opfeathr.cpp (revision 1526)
@@ -157,11 +157,11 @@
const MILLIPOINT ChangeFeatherSizeSliderOpDesc::MaxSlider = ((const MILLIPOINT) (MaxFeatherSize / 2 ));
const double ChangeFeatherSizeSliderOpDesc::SliderChangeRate = 1.5;
-INT32 OpChangeFeatherSize::s_iEditStackPos = STACKPOS_INVALID;
+INT32 OpChangeFeatherSize::s_iEditStackPos = STACKPOS_INVALID;
ListRange* OpChangeFeatherSize::s_pEditRange = NULL;
+BOOL OpChangeFeatherSize::s_DisableUpdates = FALSE;
-
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Changing feather size
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -431,6 +431,10 @@
BOOL ChangeFeatherSizeSliderOpDesc::UpdateAllFeatherControls(String_256* Str,
MILLIPOINT InverseSliderVal)
{
+ // Don't update controls if we have update disabled
+ if (OpChangeFeatherSize::IsUpdateDisabled())
+ return TRUE;
+
// Create a list for the dialogue manager to put gadget ID's on.
List* pGadgetList = new List;
if (pGadgetList == NULL)
@@ -817,7 +821,10 @@
else
s_pEditRange = NULL;
+ s_DisableUpdates = TRUE; // Disable updates to the slider triggered from this as we haven't set the new
+ // feather attribute so we risk setting it back and causing jumpiness
BROADCAST_TO_ALL(SelChangingMsg(SelChangingMsg::EFFECTSTACKCHANGED));
+ s_DisableUpdates = FALSE;
}
Index: Trunk/XaraLX/wxXtra/framemanager.h
===================================================================
--- Trunk/XaraLX/wxXtra/framemanager.h (revision 1525)
+++ Trunk/XaraLX/wxXtra/framemanager.h (revision 1526)
@@ -435,7 +435,7 @@
bool DetachPane(wxWindow* window);
wxString SavePaneInfo(wxPaneInfo& pane);
- wxString LoadPaneInfo(wxString pane_part, wxPaneInfo &pane);
+ void LoadPaneInfo(wxString pane_part, wxPaneInfo &pane);
wxString SavePerspective();
Index: Trunk/XaraLX/wxXtra/framemanager.cpp
===================================================================
--- Trunk/XaraLX/wxXtra/framemanager.cpp (revision 1525)
+++ Trunk/XaraLX/wxXtra/framemanager.cpp (revision 1526)
@@ -948,66 +948,68 @@
return result;
}
-// Load a "pane" with the pane infor settings in pane_part; return the remainder of the
-// string
-wxString wxFrameManager::LoadPaneInfo(wxString pane_part, wxPaneInfo &pane)
+// Load a "pane" with the pane infor settings in pane_part
+void wxFrameManager::LoadPaneInfo(wxString pane_part, wxPaneInfo &pane)
{
// replace escaped characters so we can
// split up the string easily
pane_part.Replace(wxT("\|"), wxT(""));
pane_part.Replace(wxT("\;"), wxT(""));
- wxString val_part = pane_part.BeforeFirst(wxT(';'));
- pane_part = pane_part.AfterFirst(wxT(';'));
- wxString val_name = val_part.BeforeFirst(wxT('='));
- wxString value = val_part.AfterFirst(wxT('='));
- val_name.MakeLower();
- val_name.Trim(true);
- val_name.Trim(false);
- value.Trim(true);
- value.Trim(false);
-
- if (val_name.empty())
- return wxEmptyString;
-
- if (val_name == wxT("name"))
- pane.name = value;
- else if (val_name == wxT("caption"))
- pane.caption = value;
- else if (val_name == wxT("state"))
- pane.state = (unsigned int)wxAtoi(value.c_str());
- else if (val_name == wxT("dir"))
- pane.dock_direction = wxAtoi(value.c_str());
- else if (val_name == wxT("layer"))
- pane.dock_layer = wxAtoi(value.c_str());
- else if (val_name == wxT("row"))
- pane.dock_row = wxAtoi(value.c_str());
- else if (val_name == wxT("pos"))
- pane.dock_pos = wxAtoi(value.c_str());
- else if (val_name == wxT("prop"))
- pane.dock_proportion = wxAtoi(value.c_str());
- else if (val_name == wxT("bestw"))
- pane.best_size.x = wxAtoi(value.c_str());
- else if (val_name == wxT("besth"))
- pane.best_size.y = wxAtoi(value.c_str());
- else if (val_name == wxT("minw"))
- pane.min_size.x = wxAtoi(value.c_str());
- else if (val_name == wxT("minh"))
- pane.min_size.y = wxAtoi(value.c_str());
- else if (val_name == wxT("maxw"))
- pane.max_size.x = wxAtoi(value.c_str());
- else if (val_name == wxT("maxh"))
- pane.max_size.y = wxAtoi(value.c_str());
- else if (val_name == wxT("floatx"))
- pane.floating_pos.x = wxAtoi(value.c_str());
- else if (val_name == wxT("floaty"))
- pane.floating_pos.y = wxAtoi(value.c_str());
- else if (val_name == wxT("floatw"))
- pane.floating_size.x = wxAtoi(value.c_str());
- else if (val_name == wxT("floath"))
- pane.floating_size.y = wxAtoi(value.c_str());
- else {
- wxFAIL_MSG(wxT("Bad Perspective String"));
+ while(1)
+ {
+ wxString val_part = pane_part.BeforeFirst(wxT(';'));
+ pane_part = pane_part.AfterFirst(wxT(';'));
+ wxString val_name = val_part.BeforeFirst(wxT('='));
+ wxString value = val_part.AfterFirst(wxT('='));
+ val_name.MakeLower();
+ val_name.Trim(true);
+ val_name.Trim(false);
+ value.Trim(true);
+ value.Trim(false);
+
+ if (val_name.empty())
+ break;
+
+ if (val_name == wxT("name"))
+ pane.name = value;
+ else if (val_name == wxT("caption"))
+ pane.caption = value;
+ else if (val_name == wxT("state"))
+ pane.state = (unsigned int)wxAtoi(value.c_str());
+ else if (val_name == wxT("dir"))
+ pane.dock_direction = wxAtoi(value.c_str());
+ else if (val_name == wxT("layer"))
+ pane.dock_layer = wxAtoi(value.c_str());
+ else if (val_name == wxT("row"))
+ pane.dock_row = wxAtoi(value.c_str());
+ else if (val_name == wxT("pos"))
+ pane.dock_pos = wxAtoi(value.c_str());
+ else if (val_name == wxT("prop"))
+ pane.dock_proportion = wxAtoi(value.c_str());
+ else if (val_name == wxT("bestw"))
+ pane.best_size.x = wxAtoi(value.c_str());
+ else if (val_name == wxT("besth"))
+ pane.best_size.y = wxAtoi(value.c_str());
+ else if (val_name == wxT("minw"))
+ pane.min_size.x = wxAtoi(value.c_str());
+ else if (val_name == wxT("minh"))
+ pane.min_size.y = wxAtoi(value.c_str());
+ else if (val_name == wxT("maxw"))
+ pane.max_size.x = wxAtoi(value.c_str());
+ else if (val_name == wxT("maxh"))
+ pane.max_size.y = wxAtoi(value.c_str());
+ else if (val_name == wxT("floatx"))
+ pane.floating_pos.x = wxAtoi(value.c_str());
+ else if (val_name == wxT("floaty"))
+ pane.floating_pos.y = wxAtoi(value.c_str());
+ else if (val_name == wxT("floatw"))
+ pane.floating_size.x = wxAtoi(value.c_str());
+ else if (val_name == wxT("floath"))
+ pane.floating_size.y = wxAtoi(value.c_str());
+ else {
+ wxFAIL_MSG(wxT("Bad Perspective String"));
+ }
}
// replace escaped characters so we can
@@ -1019,7 +1021,7 @@
pane_part.Replace(wxT(""), wxT("|"));
pane_part.Replace(wxT(""), wxT(";"));
- return pane_part;
+ return;
}
@@ -1123,10 +1125,7 @@
pane_part.Replace(wxT(""), wxT("|"));
pane_part.Replace(wxT(""), wxT(";"));
- while (!pane_part.empty())
- {
- pane_part = LoadPaneInfo(pane_part, pane);
- }
+ LoadPaneInfo(pane_part, pane);
wxPaneInfo& p = GetPane(pane.name);
if (!p.IsOk())
Index: Trunk/XaraLX/wxOil/dlgmgr.h
===================================================================
--- Trunk/XaraLX/wxOil/dlgmgr.h (revision 1525)
+++ Trunk/XaraLX/wxOil/dlgmgr.h (revision 1526)
@@ -170,6 +170,7 @@
#endif
+WX_DECLARE_STRING_HASH_MAP( wxString, IdToSerializedPaneInfo );
/********************************************************************************************
@@ -815,6 +816,10 @@
// Now our event handlers
static void Event (DialogEventHandler *pEvtHandler, wxEvent &event);
+ static void InitPaneInfoHash();
+ static void LoadPaneInfo(wxString key, wxPaneInfo &paneinfo);
+ static void SavePaneInfo(wxString key, wxPaneInfo &paneinfo);
+ static IdToSerializedPaneInfo * s_pPaneInfoHash;
};
Index: Trunk/XaraLX/wxOil/dlgmgr.cpp
===================================================================
--- Trunk/XaraLX/wxOil/dlgmgr.cpp (revision 1525)
+++ Trunk/XaraLX/wxOil/dlgmgr.cpp (revision 1526)
@@ -162,6 +162,8 @@
List DialogManager::ScrollPageIncList;
List DialogManager::DialogPositionList;
+IdToSerializedPaneInfo * DialogManager::s_pPaneInfoHash = NULL;
+
wxWindow *DialogManager::pDlgCurrent = NULL; // Required for IsDialogMessage handling
// The ActiveDialogStack is used to restore previously active dialogs after a Modal dialog
@@ -435,10 +437,32 @@
#ifdef USE_WXAUI
if (wxAUImanaged)
{
+ wxString Title = wxEmptyString;
+ if (pDialogWnd->IsKindOf(CLASSINFO(wxDialog)))
+ Title=((wxDialog *)pDialogWnd)->GetTitle();
+ if (Title.IsEmpty()) Title = pDialogWnd->GetLabel(); // because wxPanel doesn't seem to support a title
+ if (Title.IsEmpty())
+ {
+ const TCHAR * ResString=CamResource::GetTextFail(pDialogWnd->GetId());
+ if (ResString)
+ Title=wxString(ResString);
+ }
+ if (Title.IsEmpty())
+ {
+ // Finally, in desperation, we (mis-)use the tooltip string because now the wx folks have removed
+ // the label, even though it's needed for accessibility. Aarrghh
+ wxToolTip* pTip = pDialogWnd->GetToolTip();
+ if (pTip) Title=pTip->GetTip();
+ }
+ if (Title.IsEmpty())
+ Title = wxString(CamResource::GetText(_R(IDS_ANONYMOUSBARTITLE)));
+
+
// We really should take a wxPaneInfo() as an additional parameter to this function to allow this sort
// of stuff to be specified. Or try and retrieve it from the DialogBarOp or similar. Anyway, for now
// give it some default parameters
wxPaneInfo paneinfo;
+ LoadPaneInfo(wxString(CamResource::GetObjectName(pDialogWnd->GetId())), paneinfo);
paneinfo.DestroyOnClose(FALSE);
if (DlgOp->IsABar())
{
@@ -469,25 +493,7 @@
// tool switch that deletes them deleting the window.
}
- wxString Title = wxEmptyString;
- if (pDialogWnd->IsKindOf(CLASSINFO(wxDialog)))
- Title=((wxDialog *)pDialogWnd)->GetTitle();
- if (Title.IsEmpty()) Title = pDialogWnd->GetLabel(); // because wxPanel doesn't seem to support a title
- if (Title.IsEmpty())
- {
- const TCHAR * ResString=CamResource::GetTextFail(pDialogWnd->GetId());
- if (ResString)
- Title=wxString(ResString);
- }
- if (Title.IsEmpty())
- {
- // Finally, in desperation, we (mis-)use the tooltip string because now the wx folks have removed
- // the label, even though it's needed for accessibility. Aarrghh
- wxToolTip* pTip = pDialogWnd->GetToolTip();
- if (pTip) Title=pTip->GetTip();
- }
- if (Title.IsEmpty())
- Title = wxString(CamResource::GetText(_R(IDS_ANONYMOUSBARTITLE)));
+ paneinfo.Name(pDialogName).Caption(Title).PinButton(TRUE);
wxSizer * pSizer = pDialogWnd->GetSizer();
if (pSizer)
@@ -496,9 +502,7 @@
pDialogWnd->SetSizerAndFit(pSizer);
}
- CCamFrame::GetFrameManager()->AddPane(pDialogWnd, paneinfo.
- Name(pDialogName).Caption(Title).
- PinButton(TRUE));
+ CCamFrame::GetFrameManager()->AddPane(pDialogWnd, paneinfo);
CCamFrame::GetMainFrame()->UpdateFrameManager();
}
@@ -721,9 +725,87 @@
return TRUE; // Success
}
+/********************************************************************************************
+> void DialogManager::InitPaneInfoHash
+
+ Author: Alex Bligh <alex@xxxxxxxxxxx>
+ Created: 25/07/06
+ Inputs: -
+ Outputs: -
+ Returns: -
+ Purpose: Initializes the pane info hash if it has not been previously initialized
+ Scope: protected
+
+********************************************************************************************/
+
+void DialogManager::InitPaneInfoHash()
+{
+ if (s_pPaneInfoHash)
+ return;
+
+ s_pPaneInfoHash = new IdToSerializedPaneInfo;
+}
+
/********************************************************************************************
+> void DialogManager::LoadPaneInfo(wxString key, wxPaneInfo &paneinfo)
+
+ Author: Alex Bligh <alex@xxxxxxxxxxx>
+ Created: 25/07/06
+ Inputs: key - the key the pane info will be stored under
+ Outputs: paneinfo - the wxAUI pane info structure
+ Returns: None
+ Purpose: Loads the pane info structure from the hash
+ Scope: protected
+
+********************************************************************************************/
+
+void DialogManager::LoadPaneInfo(wxString key, wxPaneInfo &paneinfo)
+{
+ if (!s_pPaneInfoHash)
+ InitPaneInfoHash();
+
+ if (!s_pPaneInfoHash)
+ return;
+
+ IdToSerializedPaneInfo::iterator i=s_pPaneInfoHash->find(key);
+ if (i==s_pPaneInfoHash->end())
+ return;
+
+ TRACEUSER("amb", _T("key=%s"), (const TCHAR *)key);
+ TRACEUSER("amb", _T("val=%s"), (const TCHAR *)(i->second));
+
+ CCamFrame::GetFrameManager()->LoadPaneInfo(i->second, paneinfo);
+}
+
+/********************************************************************************************
+
+> void DialogManager::SavePaneInfo(wxPaneInfo &paneinfo)
+
+ Author: Alex Bligh <alex@xxxxxxxxxxx>
+ Created: 25/07/06
+ Inputs: key - the key the pane info will be stored under
+ paneinfo - the wxAUI pane info structure
+ Returns: None
+ Purpose: Saves the pane info structure to the hash
+ Scope: protected
+
+********************************************************************************************/
+
+void DialogManager::SavePaneInfo(wxString key, wxPaneInfo &paneinfo)
+{
+ if (!s_pPaneInfoHash)
+ InitPaneInfoHash();
+
+ if (!s_pPaneInfoHash)
+ return;
+
+ (*s_pPaneInfoHash)[key]=CCamFrame::GetFrameManager()->SavePaneInfo(paneinfo);
+}
+
+/********************************************************************************************
+
> static DialogPosition* DialogManager::FindDialogPositionRecord(CDlgResID DialogID)
Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xxxxxxxx>
@@ -1691,6 +1773,9 @@
if (pDlgOp->pEvtHandler->wxAUImanaged)
{
+ wxPaneInfo paneinfo = CCamFrame::GetMainFrame()->GetFrameManager()->GetPane(pCWnd);
+ if (paneinfo.IsOk())
+ SavePaneInfo(wxString(CamResource::GetObjectName(pCWnd->GetId())), paneinfo);
// Remove the bar from wxAUI
CCamFrame::GetMainFrame()->GetFrameManager()->DetachPane(pCWnd);
CCamFrame::GetMainFrame()->UpdateFrameManager();
@@ -6118,6 +6203,12 @@
delete DialogPositionList.RemoveItem(DlgPos);
DlgPos = NextPos;
}
+
+ if (s_pPaneInfoHash)
+ {
+ delete s_pPaneInfoHash;
+ s_pPaneInfoHash = NULL;
+ }
}
/********************************************************************************************
Xara