Kaydet (Commit) d1dda534 authored tarafından Caolán McNamara's avatar Caolán McNamara

use sizegroups and shown/hidden buttons to stop ui jitter

i.e. duplicate the buttons rather than change their content and have the same
handlers for both variants.  Hide the one we don't want at any given time and
use size-groups to get the same width regardless of the combination shown. All
so the ui doesn't jump around the place as the button content changes.

Change-Id: Icca938a6381da1feaf43fd11779d1d6d94d5d3a0
üst 60446a03
......@@ -673,13 +673,12 @@
#define STR_FUN_TEXT_SELECTION_COUNT 546
#define STR_DISMISS 547
#define STR_QUERYREMOVE 548
#define STR_COPYLIST 549
#define STR_COPYFROM 550
#define STR_COPYERR 551
#define STR_QUERYREMOVE 547
#define STR_COPYLIST 548
#define STR_COPYFROM 549
#define STR_COPYERR 550
#define STR_COUNT 552
#define STR_COUNT 551
#endif
......
......@@ -718,10 +718,10 @@
#define SCSTR_COLUMN (STR_START + 13)
#define SCSTR_ROW (STR_START + 14)
#define SCSTR_NEW (STR_START + 15)
#define SCSTR_ADD (STR_START + 16)
#define SCSTR_REMOVE (STR_START + 17)
#define SCSTR_CANCEL (STR_START + 18)
#define SCSTR_MODIFY (STR_START + 19)
#define SCSTR_SHOWTABLE (STR_START + 20)
#define SCSTR_HIDDENTABLES (STR_START + 21)
......
......@@ -54,16 +54,18 @@ private:
VclMultiLineEdit* mpEdEntries;
FixedText* mpFtCopyFrom;
Edit* mpEdCopyFrom;
PushButton* mpBtnNew;
PushButton* mpBtnDiscard;
PushButton* mpBtnAdd;
PushButton* mpBtnModify;
PushButton* mpBtnRemove;
PushButton* mpBtnCopy;
const String aStrQueryRemove;
String aStrNew;
const String aStrCancel;
const String aStrAdd;
const String aStrModify;
const String aStrCopyList;
const String aStrCopyFrom;
const String aStrCopyErr;
......
......@@ -58,9 +58,6 @@ ScTpUserLists::ScTpUserLists( Window* pParent,
"OptSortLists", "modules/scalc/ui/optsortlists.ui",
rCoreAttrs ),
aStrQueryRemove ( ScGlobal::GetRscString( STR_QUERYREMOVE ) ),
aStrCancel ( ScGlobal::GetRscString( STR_DISMISS ) ),
aStrAdd ( ScResId( SCSTR_ADD ) ),
aStrModify ( ScResId( SCSTR_MODIFY ) ),
aStrCopyList ( ScGlobal::GetRscString( STR_COPYLIST ) ),
aStrCopyFrom ( ScGlobal::GetRscString( STR_COPYFROM ) ),
aStrCopyErr ( ScGlobal::GetRscString( STR_COPYERR ) ),
......@@ -81,12 +78,12 @@ ScTpUserLists::ScTpUserLists( Window* pParent,
get(mpFtCopyFrom, "copyfromlabel");
get(mpEdCopyFrom, "copyfrom");
get(mpBtnNew, "new");
get(mpBtnDiscard, "discard");
get(mpBtnAdd, "add");
get(mpBtnModify, "modify");
get(mpBtnRemove, "delete");
get(mpBtnCopy, "copy");
aStrNew = mpBtnNew->GetText();
SetExchangeSupport();
Init();
Reset(rCoreAttrs);
......@@ -109,8 +106,9 @@ void ScTpUserLists::Init()
mpLbLists->SetSelectHdl ( LINK( this, ScTpUserLists, LbSelectHdl ) );
mpBtnNew->SetClickHdl ( LINK( this, ScTpUserLists, BtnClickHdl ) );
mpBtnNew->SetClickHdl ( LINK( this, ScTpUserLists, BtnClickHdl ) );
mpBtnDiscard->SetClickHdl ( LINK( this, ScTpUserLists, BtnClickHdl ) );
mpBtnAdd->SetClickHdl ( LINK( this, ScTpUserLists, BtnClickHdl ) );
mpBtnModify->SetClickHdl ( LINK( this, ScTpUserLists, BtnClickHdl ) );
mpBtnRemove->SetClickHdl ( LINK( this, ScTpUserLists, BtnClickHdl ) );
mpEdEntries->SetModifyHdl ( LINK( this, ScTpUserLists, EdEntriesModHdl ) );
......@@ -192,9 +190,12 @@ void ScTpUserLists::Reset( const SfxItemSet& rCoreAttrs )
mpBtnRemove->Disable();
}
mpBtnNew->SetText( aStrNew );
mpBtnAdd->SetText( aStrAdd );
mpBtnNew->Show();
mpBtnDiscard->Hide();
mpBtnAdd->Show();
mpBtnModify->Hide();
mpBtnAdd->Disable();
mpBtnModify->Disable();
if ( !bCopyDone && pViewData )
{
......@@ -493,7 +494,11 @@ IMPL_LINK( ScTpUserLists, LbSelectHdl, ListBox*, pLb )
if ( !mpFtEntries->IsEnabled() ) mpFtEntries->Enable();
if ( !mpEdEntries->IsEnabled() ) mpEdEntries->Enable();
if ( !mpBtnRemove->IsEnabled() ) mpBtnRemove->Enable();
if ( mpBtnAdd->IsEnabled() ) mpBtnAdd->Disable();
if ( mpBtnAdd->IsEnabled() )
{
mpBtnAdd->Disable();
mpBtnModify->Disable();
}
UpdateEntries( nSelPos );
}
......@@ -506,7 +511,7 @@ IMPL_LINK( ScTpUserLists, LbSelectHdl, ListBox*, pLb )
IMPL_LINK( ScTpUserLists, BtnClickHdl, PushButton*, pBtn )
{
if ( pBtn == mpBtnNew )
if ( pBtn == mpBtnNew || pBtn == mpBtnDiscard )
{
if ( !bCancelMode )
{
......@@ -521,6 +526,7 @@ IMPL_LINK( ScTpUserLists, BtnClickHdl, PushButton*, pBtn )
mpEdEntries->SetText( EMPTY_STRING );
mpEdEntries->GrabFocus();
mpBtnAdd->Disable();
mpBtnModify->Disable();
mpBtnRemove->Disable();
//-----------------------------
if ( mpBtnCopy->IsEnabled() )
......@@ -529,7 +535,8 @@ IMPL_LINK( ScTpUserLists, BtnClickHdl, PushButton*, pBtn )
mpFtCopyFrom->Disable();
mpEdCopyFrom->Disable();
}
mpBtnNew->SetText( aStrCancel );
mpBtnNew->Hide();
mpBtnDiscard->Show();
bCancelMode = sal_True;
}
else // if ( bCancelMode )
......@@ -549,6 +556,7 @@ IMPL_LINK( ScTpUserLists, BtnClickHdl, PushButton*, pBtn )
mpBtnRemove->Disable();
}
mpBtnAdd->Disable();
mpBtnModify->Disable();
//-----------------------------
if ( pViewData && !bCopyDone )
{
......@@ -556,12 +564,13 @@ IMPL_LINK( ScTpUserLists, BtnClickHdl, PushButton*, pBtn )
mpFtCopyFrom->Enable();
mpEdCopyFrom->Enable();
}
mpBtnNew->SetText( aStrNew );
mpBtnNew->Show();
mpBtnDiscard->Hide();
bCancelMode = false;
bModifyMode = false;
}
}
else if ( pBtn == mpBtnAdd )
else if (pBtn == mpBtnAdd || pBtn == mpBtnModify)
{
String theEntriesStr( mpEdEntries->GetText() );
......@@ -588,8 +597,10 @@ IMPL_LINK( ScTpUserLists, BtnClickHdl, PushButton*, pBtn )
}
mpBtnAdd->Disable();
mpBtnModify->Disable();
mpBtnRemove->Enable();
mpBtnNew->SetText( aStrNew );
mpBtnNew->Show();
mpBtnDiscard->Hide();
bCancelMode = false;
}
else // if ( bModifyMode )
......@@ -610,9 +621,14 @@ IMPL_LINK( ScTpUserLists, BtnClickHdl, PushButton*, pBtn )
LbSelectHdl( mpLbLists );
}
mpBtnNew->SetText( aStrNew ); bCancelMode = false;
mpBtnAdd->SetText( aStrAdd ); bModifyMode = false;
mpBtnNew->Show();
mpBtnDiscard->Hide();
bCancelMode = false;
mpBtnAdd->Show();
mpBtnModify->Show();
mpBtnAdd->Disable();
mpBtnModify->Disable();
bModifyMode = false;
mpBtnRemove->Enable();
mpFtLists->Enable();
mpLbLists->Enable();
......@@ -748,21 +764,34 @@ IMPL_LINK( ScTpUserLists, EdEntriesModHdl, VclMultiLineEdit*, pEd )
{
if ( !bCancelMode && !bModifyMode )
{
mpBtnNew->SetText( aStrCancel ); bCancelMode = sal_True;
mpBtnAdd->SetText( aStrModify ); bModifyMode = sal_True;
mpBtnNew->Hide();
mpBtnDiscard->Show();
bCancelMode = sal_True;
mpBtnAdd->Hide();
mpBtnAdd->Enable();
mpBtnModify->Show();
mpBtnModify->Enable();
bModifyMode = sal_True;
mpBtnRemove->Disable();
mpFtLists->Disable();
mpLbLists->Disable();
}
else // if ( bCancelMode || bModifyMode )
{
if ( !mpBtnAdd->IsEnabled() ) mpBtnAdd->Enable();
if ( !mpBtnAdd->IsEnabled() )
{
mpBtnAdd->Enable();
mpBtnModify->Enable();
}
}
}
else
{
if ( mpBtnAdd->IsEnabled() ) mpBtnAdd->Disable();
if ( mpBtnAdd->IsEnabled() )
{
mpBtnAdd->Disable();
mpBtnModify->Disable();
}
}
return 0;
......
......@@ -2065,10 +2065,6 @@ Resource RID_GLOBSTR
{
Text [ en-US ] = "Invalid condition." ;
};
String STR_DISMISS
{
Text [ en-US ] = "~Discard" ;
};
String STR_QUERYREMOVE
{
Text [ en-US ] = "Should the entry\n#\nbe deleted?" ;
......
......@@ -215,11 +215,6 @@ String SCSTR_NEW
Text [ en-US ] = "~New" ;
};
String SCSTR_ADD
{
Text [ en-US ] = "~Add" ;
};
String SCSTR_REMOVE
{
Text [ en-US ] = "~Delete" ;
......@@ -230,11 +225,6 @@ String SCSTR_CANCEL
Text [ en-US ] = "Cance~l" ;
};
String SCSTR_MODIFY
{
Text [ en-US ] = "Modif~y" ;
};
String SCSTR_SHOWTABLE
{
Text [ en-US ] = "Show Sheet" ;
......
......@@ -34,6 +34,20 @@
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="discard">
<property name="label" translatable="yes">_Discard</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="no_show_all">True</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="add">
<property name="label" translatable="yes">_Add</property>
......@@ -45,7 +59,21 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="modify">
<property name="label" translatable="yes">Modif_y</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="no_show_all">True</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
<child>
......@@ -59,7 +87,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
<property name="position">4</property>
</packing>
</child>
</object>
......@@ -213,4 +241,16 @@
</packing>
</child>
</object>
<object class="GtkSizeGroup" id="sizegroup1">
<widgets>
<widget name="new"/>
<widget name="discard"/>
</widgets>
</object>
<object class="GtkSizeGroup" id="sizegroup2">
<widgets>
<widget name="add"/>
<widget name="modify"/>
</widgets>
</object>
</interface>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment