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

convert new lib dialog to .ui

and a drive-by on some no .src InfoBox and ErrorBoxes to MessageDialog

Change-Id: Ideb58a0042ed45a49bff9b336622dfe11bb363ab
üst 92253e15
...@@ -31,6 +31,7 @@ $(eval $(call gb_UIConfig_add_toolbarfiles,modules/BasicIDE,\ ...@@ -31,6 +31,7 @@ $(eval $(call gb_UIConfig_add_toolbarfiles,modules/BasicIDE,\
$(eval $(call gb_UIConfig_add_uifiles,modules/BasicIDE,\ $(eval $(call gb_UIConfig_add_uifiles,modules/BasicIDE,\
basctl/uiconfig/basicide/ui/basicmacrodialog \ basctl/uiconfig/basicide/ui/basicmacrodialog \
basctl/uiconfig/basicide/ui/gotolinedialog \ basctl/uiconfig/basicide/ui/gotolinedialog \
basctl/uiconfig/basicide/ui/newlibdialog \
basctl/uiconfig/basicide/ui/organizedialog \ basctl/uiconfig/basicide/ui/organizedialog \
)) ))
......
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
#define RID_TP_LIBS ( RID_BASICIDE_START + 38 ) #define RID_TP_LIBS ( RID_BASICIDE_START + 38 )
#define RID_TP_DLGS ( RID_BASICIDE_START + 39 ) #define RID_TP_DLGS ( RID_BASICIDE_START + 39 )
#define RID_DLG_LIBS ( RID_BASICIDE_START + 40 ) #define RID_DLG_LIBS ( RID_BASICIDE_START + 40 )
#define RID_DLG_NEWLIB ( RID_BASICIDE_START + 42 )
#define RID_DLG_EXPORT ( RID_BASICIDE_START + 43 ) #define RID_DLG_EXPORT ( RID_BASICIDE_START + 43 )
#define RID_POPUP_DLGED ( RID_BASICIDE_START + 62 ) #define RID_POPUP_DLGED ( RID_BASICIDE_START + 62 )
#define RID_PRINTDLG_STRLIST ( RID_BASICIDE_START + 78 ) #define RID_PRINTDLG_STRLIST ( RID_BASICIDE_START + 78 )
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ */
#include <vcl/msgbox.hxx> #include <vcl/layout.hxx>
#include <sot/storinfo.hxx> #include <sot/storinfo.hxx>
#include <moduldlg.hrc> #include <moduldlg.hrc>
...@@ -291,7 +291,7 @@ sal_Bool CheckBox::EditingEntry( SvTreeListEntry* pEntry, Selection& ) ...@@ -291,7 +291,7 @@ sal_Bool CheckBox::EditingEntry( SvTreeListEntry* pEntry, Selection& )
OUString aLibName = GetEntryText( pEntry, 0 ); OUString aLibName = GetEntryText( pEntry, 0 );
if ( aLibName.equalsIgnoreAsciiCase( "Standard" ) ) if ( aLibName.equalsIgnoreAsciiCase( "Standard" ) )
{ {
ErrorBox( this, WB_OK | WB_DEF_OK, IDE_RESSTR(RID_STR_CANNOTCHANGENAMESTDLIB) ).Execute(); MessageDialog(this, IDE_RESSTR(RID_STR_CANNOTCHANGENAMESTDLIB)).Execute();
return false; return false;
} }
...@@ -301,7 +301,7 @@ sal_Bool CheckBox::EditingEntry( SvTreeListEntry* pEntry, Selection& ) ...@@ -301,7 +301,7 @@ sal_Bool CheckBox::EditingEntry( SvTreeListEntry* pEntry, Selection& )
if ( ( xModLibContainer.is() && xModLibContainer->hasByName( aLibName ) && xModLibContainer->isLibraryReadOnly( aLibName ) && !xModLibContainer->isLibraryLink( aLibName ) ) || if ( ( xModLibContainer.is() && xModLibContainer->hasByName( aLibName ) && xModLibContainer->isLibraryReadOnly( aLibName ) && !xModLibContainer->isLibraryLink( aLibName ) ) ||
( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aLibName ) && xDlgLibContainer->isLibraryReadOnly( aLibName ) && !xDlgLibContainer->isLibraryLink( aLibName ) ) ) ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aLibName ) && xDlgLibContainer->isLibraryReadOnly( aLibName ) && !xDlgLibContainer->isLibraryLink( aLibName ) ) )
{ {
ErrorBox( this, WB_OK | WB_DEF_OK, IDE_RESSTR(RID_STR_LIBISREADONLY) ).Execute(); MessageDialog(this, IDE_RESSTR(RID_STR_LIBISREADONLY)).Execute();
return false; return false;
} }
...@@ -353,7 +353,7 @@ sal_Bool CheckBox::EditedEntry( SvTreeListEntry* pEntry, const OUString& rNewNam ...@@ -353,7 +353,7 @@ sal_Bool CheckBox::EditedEntry( SvTreeListEntry* pEntry, const OUString& rNewNam
} }
catch (const container::ElementExistException& ) catch (const container::ElementExistException& )
{ {
ErrorBox( this, WB_OK | WB_DEF_OK, IDE_RESSTR(RID_STR_SBXNAMEALLREADYUSED) ).Execute(); MessageDialog(this, IDE_RESSTR(RID_STR_SBXNAMEALLREADYUSED)).Execute();
return false; return false;
} }
catch (const container::NoSuchElementException& ) catch (const container::NoSuchElementException& )
...@@ -366,9 +366,9 @@ sal_Bool CheckBox::EditedEntry( SvTreeListEntry* pEntry, const OUString& rNewNam ...@@ -366,9 +366,9 @@ sal_Bool CheckBox::EditedEntry( SvTreeListEntry* pEntry, const OUString& rNewNam
if ( !bValid ) if ( !bValid )
{ {
if ( rNewName.getLength() > 30 ) if ( rNewName.getLength() > 30 )
ErrorBox( this, WB_OK | WB_DEF_OK, IDE_RESSTR(RID_STR_LIBNAMETOLONG) ).Execute(); MessageDialog(this, IDE_RESSTR(RID_STR_LIBNAMETOLONG)).Execute();
else else
ErrorBox( this, WB_OK | WB_DEF_OK, IDE_RESSTR(RID_STR_BADSBXNAME) ).Execute(); MessageDialog(this, IDE_RESSTR(RID_STR_BADSBXNAME)).Execute();
} }
return bValid; return bValid;
...@@ -380,27 +380,24 @@ sal_Bool CheckBox::EditedEntry( SvTreeListEntry* pEntry, const OUString& rNewNam ...@@ -380,27 +380,24 @@ sal_Bool CheckBox::EditedEntry( SvTreeListEntry* pEntry, const OUString& rNewNam
IMPL_LINK_NOARG(NewObjectDialog, OkButtonHandler) IMPL_LINK_NOARG(NewObjectDialog, OkButtonHandler)
{ {
if (IsValidSbxName(aEdit.GetText())) if (IsValidSbxName(m_pEdit->GetText()))
EndDialog(1); EndDialog(1);
else else
{ {
ErrorBox(this, WB_OK | WB_DEF_OK, MessageDialog(this, IDE_RESSTR(RID_STR_BADSBXNAME)).Execute();
IDE_RESSTR(RID_STR_BADSBXNAME)).Execute(); m_pEdit->GrabFocus();
aEdit.GrabFocus();
} }
return 0; return 0;
} }
NewObjectDialog::NewObjectDialog(Window * pParent, ObjectMode::Mode eMode, NewObjectDialog::NewObjectDialog(Window * pParent, ObjectMode::Mode eMode,
bool bCheckName) bool bCheckName)
: ModalDialog( pParent, IDEResId( RID_DLG_NEWLIB ) ), : ModalDialog(pParent, "NewLibDialog", "modules/BasicIDE/ui/newlibdialog.ui")
aText( this, IDEResId( RID_FT_NEWLIB ) ),
aEdit( this, IDEResId( RID_ED_LIBNAME ) ),
aOKButton( this, IDEResId( RID_PB_OK ) ),
aCancelButton( this, IDEResId( RID_PB_CANCEL ) )
{ {
FreeResource(); get(m_pOKButton, "ok");
aEdit.GrabFocus(); get(m_pEdit, "entry");
m_pEdit->GrabFocus();
switch (eMode) switch (eMode)
{ {
...@@ -421,16 +418,9 @@ NewObjectDialog::NewObjectDialog(Window * pParent, ObjectMode::Mode eMode, ...@@ -421,16 +418,9 @@ NewObjectDialog::NewObjectDialog(Window * pParent, ObjectMode::Mode eMode,
} }
if (bCheckName) if (bCheckName)
aOKButton.SetClickHdl(LINK(this, NewObjectDialog, OkButtonHandler)); m_pOKButton->SetClickHdl(LINK(this, NewObjectDialog, OkButtonHandler));
} }
//----------------------------------------------------------------------------
NewObjectDialog::~NewObjectDialog()
{
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// GotoLineDialog // GotoLineDialog
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
...@@ -878,7 +868,7 @@ void LibPage::InsertLib() ...@@ -878,7 +868,7 @@ void LibPage::InsertLib()
} }
if ( !pLibDlg ) if ( !pLibDlg )
InfoBox( this, IDE_RESSTR(RID_STR_NOLIBINSTORAGE) ).Execute(); MessageDialog(this, IDE_RESSTR(RID_STR_NOLIBINSTORAGE), VCL_MESSAGE_INFO).Execute();
else else
{ {
bool bChanges = false; bool bChanges = false;
...@@ -915,7 +905,7 @@ void LibPage::InsertLib() ...@@ -915,7 +905,7 @@ void LibPage::InsertLib()
// check, if the library is the Standard library // check, if the library is the Standard library
if ( aLibName == "Standard" ) if ( aLibName == "Standard" )
{ {
ErrorBox( this, WB_OK | WB_DEF_OK, IDE_RESSTR(RID_STR_REPLACESTDLIB) ).Execute(); MessageDialog(this, IDE_RESSTR(RID_STR_REPLACESTDLIB)).Execute();
continue; continue;
} }
...@@ -927,7 +917,7 @@ void LibPage::InsertLib() ...@@ -927,7 +917,7 @@ void LibPage::InsertLib()
aErrStr = aErrStr.replaceAll("XX", aLibName); aErrStr = aErrStr.replaceAll("XX", aLibName);
aErrStr += "\n"; aErrStr += "\n";
aErrStr += IDE_RESSTR(RID_STR_LIBISREADONLY); aErrStr += IDE_RESSTR(RID_STR_LIBISREADONLY);
ErrorBox( this, WB_OK | WB_DEF_OK, aErrStr ).Execute(); MessageDialog(this, aErrStr).Execute();
continue; continue;
} }
...@@ -944,7 +934,7 @@ void LibPage::InsertLib() ...@@ -944,7 +934,7 @@ void LibPage::InsertLib()
aErrStr = aErrStr.replaceAll("XX", aLibName); aErrStr = aErrStr.replaceAll("XX", aLibName);
aErrStr += "\n" ; aErrStr += "\n" ;
aErrStr += IDE_RESSTR(RID_STR_SBXNAMEALLREADYUSED); aErrStr += IDE_RESSTR(RID_STR_SBXNAMEALLREADYUSED);
ErrorBox( this, WB_OK | WB_DEF_OK, aErrStr ).Execute(); MessageDialog(this, aErrStr).Execute();
continue; continue;
} }
} }
...@@ -963,7 +953,7 @@ void LibPage::InsertLib() ...@@ -963,7 +953,7 @@ void LibPage::InsertLib()
{ {
OUString aErrStr( IDE_RESSTR(RID_STR_NOIMPORT) ); OUString aErrStr( IDE_RESSTR(RID_STR_NOIMPORT) );
aErrStr = aErrStr.replaceAll("XX", aLibName); aErrStr = aErrStr.replaceAll("XX", aLibName);
ErrorBox( this, WB_OK | WB_DEF_OK, aErrStr ).Execute(); MessageDialog(this, aErrStr).Execute();
continue; continue;
} }
} }
...@@ -1555,17 +1545,15 @@ void createLibImpl( Window* pWin, const ScriptDocument& rDocument, ...@@ -1555,17 +1545,15 @@ void createLibImpl( Window* pWin, const ScriptDocument& rDocument,
if ( aLibName.getLength() > 30 ) if ( aLibName.getLength() > 30 )
{ {
ErrorBox( pWin, WB_OK | WB_DEF_OK, IDEResId(RID_STR_LIBNAMETOLONG).toString() ).Execute(); MessageDialog(pWin, IDEResId(RID_STR_LIBNAMETOLONG).toString()).Execute();
} }
else if ( !IsValidSbxName( aLibName ) ) else if ( !IsValidSbxName( aLibName ) )
{ {
ErrorBox( pWin, WB_OK | WB_DEF_OK, MessageDialog(pWin, IDEResId(RID_STR_BADSBXNAME).toString()).Execute();
IDEResId(RID_STR_BADSBXNAME).toString() ).Execute();
} }
else if ( rDocument.hasLibrary( E_SCRIPTS, aLibName ) || rDocument.hasLibrary( E_DIALOGS, aLibName ) ) else if ( rDocument.hasLibrary( E_SCRIPTS, aLibName ) || rDocument.hasLibrary( E_DIALOGS, aLibName ) )
{ {
ErrorBox( pWin, WB_OK | WB_DEF_OK, MessageDialog(pWin, IDEResId(RID_STR_SBXNAMEALLREADYUSED2).toString()).Execute();
IDEResId(RID_STR_SBXNAMEALLREADYUSED2).toString() ).Execute();
} }
else else
{ {
......
...@@ -54,19 +54,18 @@ namespace ObjectMode ...@@ -54,19 +54,18 @@ namespace ObjectMode
class NewObjectDialog : public ModalDialog class NewObjectDialog : public ModalDialog
{ {
private: private:
FixedText aText; Edit* m_pEdit;
Edit aEdit; OKButton* m_pOKButton;
OKButton aOKButton;
CancelButton aCancelButton;
DECL_LINK(OkButtonHandler, void *); DECL_LINK(OkButtonHandler, void *);
public: public:
NewObjectDialog (Window* pParent, ObjectMode::Mode, bool bCheckName = false); NewObjectDialog (Window* pParent, ObjectMode::Mode, bool bCheckName = false);
virtual ~NewObjectDialog (); OUString GetObjectName() const { return m_pEdit->GetText(); }
void SetObjectName( const OUString& rName )
OUString GetObjectName() const { return aEdit.GetText(); } {
void SetObjectName( const OUString& rName ) { aEdit.SetText( rName ); aEdit.SetSelection( Selection( 0, rName.getLength() ) );} m_pEdit->SetText( rName );
m_pEdit->SetSelection(Selection( 0, rName.getLength()));
}
}; };
class GotoLineDialog : public ModalDialog class GotoLineDialog : public ModalDialog
......
...@@ -272,43 +272,6 @@ ModalDialog RID_DLG_LIBS ...@@ -272,43 +272,6 @@ ModalDialog RID_DLG_LIBS
}; };
}; };
ModalDialog RID_DLG_NEWLIB
{
HelpID = "basctl:ModalDialog:RID_DLG_NEWLIB";
OutputSize = TRUE ;
SVLook = TRUE ;
Size = MAP_APPFONT ( 160 , 55 ) ;
Moveable = TRUE ;
Closeable = TRUE ;
OKButton RID_PB_OK
{
Pos = MAP_APPFONT ( 104 , 6 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
TabStop = TRUE ;
DefButton = TRUE ;
};
CancelButton RID_PB_CANCEL
{
Pos = MAP_APPFONT ( 104 , 23 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
TabStop = TRUE ;
};
FixedText RID_FT_NEWLIB
{
Pos = MAP_APPFONT ( 6 , 6 ) ;
Size = MAP_APPFONT ( 100 , 10 ) ;
Text [ en-US ] = "~Name:" ;
};
Edit RID_ED_LIBNAME
{
HelpID = "basctl:Edit:RID_DLG_NEWLIB:RID_ED_LIBNAME";
Border = TRUE ;
Pos = MAP_APPFONT ( 6 , 19 ) ;
Size = MAP_APPFONT ( 92 , 12 ) ;
TabStop = TRUE ;
};
};
ModalDialog RID_DLG_EXPORT ModalDialog RID_DLG_EXPORT
{ {
HelpID = "basctl:ModalDialog:RID_DLG_EXPORT"; HelpID = "basctl:ModalDialog:RID_DLG_EXPORT";
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.16.0 on Tue Dec 31 20:57:07 2013 -->
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkDialog" id="NewLibDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkGrid" id="grid3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<property name="row_homogeneous">True</property>
<child>
<object class="GtkLabel" id="area">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Name:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">entry</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="ok">
<property name="label">gtk-ok</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="cancel">
<property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="0">ok</action-widget>
<action-widget response="0">cancel</action-widget>
</action-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