diff options
author | Gergo Mocsi <gmocsi91@gmail.com> | 2013-07-31 17:08:18 +0200 |
---|---|---|
committer | Gergo Mocsi <gmocsi91@gmail.com> | 2013-09-02 18:16:53 +0200 |
commit | 27da1e7340c37c4cc098a367592da9e0ed42f7dc (patch) | |
tree | 7bbc86571dc65b85ab3d8da437732ce1f1736ef6 | |
parent | c40ba9c3e041a5b94bcbc2be7aa49a1c7df6a188 (diff) |
GSOC work, ListBox appearance fix (at the borders) + code fixes
ListBox appearance fixed at the borders:
a) bottom: it it placed over the current line (not under)
b) right side: listbox's right side is adjusted to the window's right side
Coed fixes:
CodeCompleteOptions now intializes itself from the configuration file BasicIDE.xcs
Added a checkbox for enabling extended types in the options dialog.
Cursor is visible when the listbox is active.
Fixed the small issue when deleting a character.
Change-Id: I68b80143de245cebfce65cdd8af37ea4694aa81b
-rw-r--r-- | basctl/source/basicide/baside2b.cxx | 23 | ||||
-rw-r--r-- | basctl/source/basicide/codecompleteoptionsdlg.cxx | 29 | ||||
-rw-r--r-- | basctl/source/basicide/codecompleteoptionsdlg.hxx | 3 | ||||
-rw-r--r-- | basctl/uiconfig/basicide/ui/codecompleteoptionsdlg.ui | 17 | ||||
-rw-r--r-- | basic/Library_sb.mk | 4 | ||||
-rw-r--r-- | basic/source/classes/codecompletecache.cxx | 15 | ||||
-rw-r--r-- | basic/source/classes/sbxmod.cxx | 2 | ||||
-rw-r--r-- | include/basic/codecompletecache.hxx | 3 | ||||
-rw-r--r-- | officecfg/registry/schema/org/openoffice/Office/BasicIDE.xcs | 6 |
9 files changed, 89 insertions, 13 deletions
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index 15ff4260069a..14460013aed1 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -752,6 +752,7 @@ void EditorWindow::KeyInput( const KeyEvent& rKEvt ) pCodeCompleteWnd->Show(); pCodeCompleteWnd->ResizeListBox(); pCodeCompleteWnd->SelectFirstEntry(); + pEditView->GetWindow()->GrabFocus(); } } } @@ -2611,7 +2612,7 @@ long CodeCompleteListBox::PreNotify( NotifyEvent& rNEvt ) { TextPaM aEnd(pCodeCompleteWindow->aTextSelection.GetEnd().GetPara(), pCodeCompleteWindow->GetTextSelection().GetEnd().GetIndex() + aFuncBuffer.getLength()); TextPaM aStart(pCodeCompleteWindow->aTextSelection.GetEnd().GetPara(), pCodeCompleteWindow->GetTextSelection().GetEnd().GetIndex() + aFuncBuffer.getLength()-1); - aFuncBuffer.stripEnd(aFuncBuffer[aFuncBuffer.getLength()-1]); + aFuncBuffer = aFuncBuffer.remove(aFuncBuffer.getLength()-1, 1); pCodeCompleteWindow->pParent->GetEditView()->SetSelection(TextSelection(aStart, aEnd)); pCodeCompleteWindow->pParent->GetEditView()->DeleteSelected(); SetVisibleEntries(); @@ -2695,9 +2696,27 @@ void CodeCompleteWindow::ResizeListBox() Size aSize = pListBox->CalcSize( aLongestEntry.getLength(), std::min( (sal_uInt16) 4, pListBox->GetEntryCount()) ); const Font& aFont = pListBox->GetUnzoomedControlPointFont(); + Rectangle aVisArea( pParent->GetEditView()->GetStartDocPos(), pParent->GetOutputSizePixel() ); aSize.setHeight( aFont.GetSize().getHeight() * 16 ); aSize.setWidth( pListBox->CalcSize(aLongestEntry.getLength(), pListBox->GetEntryCount()).getWidth() ); - + Point aBottomPoint = aVisArea.BottomRight(); + Point aTopPoint = aVisArea.TopRight(); + long nYDiff = std::abs((aBottomPoint.Y() - aTopPoint.Y()) - GetPosPixel().Y()); + + if( (nYDiff + aFont.GetSize().getHeight()) < aSize.Height() ) + {//bottom part is clipped, fix the visibility by placing it over the line (not under) + //std::cerr << "clipped at the bottom" << std::endl; + Point aPos = GetPosPixel(); + aPos.Y() = aPos.Y() - (aSize.getHeight() + aFont.GetSize().getHeight()); + SetPosPixel(aPos); + } + long nXDiff = std::abs(aTopPoint.X() - GetPosPixel().X()); + if( nXDiff < aSize.Width() ) + {//clipped at the right side, move it a bit left + Point aPos = GetPosPixel(); + aPos.X() = aPos.X() - aSize.Width() + nXDiff; + SetPosPixel(aPos); + } pListBox->SetSizePixel( aSize ); aSize.setWidth( aSize.getWidth() + 1 ); aSize.setHeight( aSize.getHeight() + 1 ); diff --git a/basctl/source/basicide/codecompleteoptionsdlg.cxx b/basctl/source/basicide/codecompleteoptionsdlg.cxx index 130f3617715c..e8537c616528 100644 --- a/basctl/source/basicide/codecompleteoptionsdlg.cxx +++ b/basctl/source/basicide/codecompleteoptionsdlg.cxx @@ -39,16 +39,15 @@ CodeCompleteOptionsDlg::CodeCompleteOptionsDlg( Window* pWindow ) get(pAutocloseParenChk, "autoclose_paren"); get(pAutocloseQuotesChk, "autoclose_quotes"); get(pAutoCorrectSpellingChk, "autocorrect_spelling"); + get(pUseExtendedTypesChk, "extendedtypes_enable"); pOkBtn->SetClickHdl( LINK( this, CodeCompleteOptionsDlg, OkHdl ) ); pCancelBtn->SetClickHdl( LINK( this, CodeCompleteOptionsDlg, CancelHdl ) ); - LoadConfig(); - /*pCodeCompleteChk->Check( CodeCompleteOptions::IsCodeCompleteOn() ); - pAutocloseProcChk->Check( CodeCompleteOptions::IsProcedureAutoCompleteOn() ); - pAutocloseQuotesChk->Check( CodeCompleteOptions::IsAutoCloseQuotesOn() ); - pAutocloseParenChk->Check( CodeCompleteOptions::IsAutoCloseParenthesisOn() ); - pAutoCorrectSpellingChk->Check( CodeCompleteOptions::IsAutoCorrectSpellingOn() );*/ + pCodeCompleteChk->SetToggleHdl( LINK(this, CodeCompleteOptionsDlg, CodeCompleteHdl) ); + pUseExtendedTypesChk->SetToggleHdl( LINK(this, CodeCompleteOptionsDlg, ExtendedTypesHdl) ); + + LoadConfig(); } @@ -63,6 +62,7 @@ IMPL_LINK_NOARG(CodeCompleteOptionsDlg, OkHdl) CodeCompleteOptions::SetAutoCloseQuotesOn( pAutocloseQuotesChk->IsChecked() ); CodeCompleteOptions::SetAutoCloseParenthesisOn( pAutocloseParenChk->IsChecked() ); CodeCompleteOptions::SetAutoCorrectSpellingOn( pAutoCorrectSpellingChk->IsChecked() ); + CodeCompleteOptions::SetExtendedTypeDeclaration( pAutoCorrectSpellingChk->IsChecked() ); SaveConfig(); Close(); @@ -75,6 +75,18 @@ IMPL_LINK_NOARG(CodeCompleteOptionsDlg, CancelHdl) return 0; } +IMPL_LINK_NOARG(CodeCompleteOptionsDlg, ExtendedTypesHdl) +{ + pCodeCompleteChk->Check( pUseExtendedTypesChk->IsChecked() ); + return 0; +} + +IMPL_LINK_NOARG(CodeCompleteOptionsDlg, CodeCompleteHdl) +{ + pUseExtendedTypesChk->Check( pCodeCompleteChk->IsChecked() ); + return 0; +} + short CodeCompleteOptionsDlg::Execute() { return ModalDialog::Execute(); @@ -83,6 +95,7 @@ short CodeCompleteOptionsDlg::Execute() void CodeCompleteOptionsDlg::LoadConfig() { bool bProcClose = officecfg::Office::BasicIDE::Autocomplete::AutocloseProc::get(); + bool bExtended = officecfg::Office::BasicIDE::Autocomplete::UseExtended::get(); bool bCodeCompleteOn = officecfg::Office::BasicIDE::Autocomplete::CodeComplete::get(); bool bParenClose = officecfg::Office::BasicIDE::Autocomplete::AutocloseParenthesis::get(); bool bQuoteClose = officecfg::Office::BasicIDE::Autocomplete::AutocloseDoubleQuotes::get(); @@ -93,13 +106,15 @@ void CodeCompleteOptionsDlg::LoadConfig() pAutocloseQuotesChk->Check( bQuoteClose ); pAutocloseParenChk->Check( bParenClose ); pAutoCorrectSpellingChk->Check( bCorrect ); + pUseExtendedTypesChk->Check( bExtended ); } void CodeCompleteOptionsDlg::SaveConfig() { - boost::shared_ptr< comphelper::ConfigurationChanges > batch(comphelper::ConfigurationChanges::create()); + boost::shared_ptr< comphelper::ConfigurationChanges > batch( comphelper::ConfigurationChanges::create() ); officecfg::Office::BasicIDE::Autocomplete::AutocloseProc::set( pAutocloseProcChk->IsChecked(), batch ); officecfg::Office::BasicIDE::Autocomplete::CodeComplete::set( pCodeCompleteChk->IsChecked(), batch ); + officecfg::Office::BasicIDE::Autocomplete::UseExtended::set( pUseExtendedTypesChk->IsChecked(), batch ); officecfg::Office::BasicIDE::Autocomplete::AutocloseParenthesis::set( pAutocloseParenChk->IsChecked(), batch ); officecfg::Office::BasicIDE::Autocomplete::AutocloseDoubleQuotes::set( pAutocloseQuotesChk->IsChecked(), batch ); officecfg::Office::BasicIDE::Autocomplete::AutoCorrectSpelling::set( pAutoCorrectSpellingChk->IsChecked(), batch ); diff --git a/basctl/source/basicide/codecompleteoptionsdlg.hxx b/basctl/source/basicide/codecompleteoptionsdlg.hxx index 6314841daaed..781118b5c510 100644 --- a/basctl/source/basicide/codecompleteoptionsdlg.hxx +++ b/basctl/source/basicide/codecompleteoptionsdlg.hxx @@ -37,9 +37,12 @@ private: CheckBox* pAutocloseParenChk; CheckBox* pAutocloseQuotesChk; CheckBox* pAutoCorrectSpellingChk; + CheckBox* pUseExtendedTypesChk; DECL_LINK(OkHdl, void*); DECL_LINK(CancelHdl, void*); + DECL_LINK(ExtendedTypesHdl, void*); + DECL_LINK(CodeCompleteHdl, void*); void LoadConfig(); void SaveConfig(); diff --git a/basctl/uiconfig/basicide/ui/codecompleteoptionsdlg.ui b/basctl/uiconfig/basicide/ui/codecompleteoptionsdlg.ui index 50f16f7f9e24..486118885959 100644 --- a/basctl/uiconfig/basicide/ui/codecompleteoptionsdlg.ui +++ b/basctl/uiconfig/basicide/ui/codecompleteoptionsdlg.ui @@ -4,7 +4,7 @@ <object class="GtkDialog" id="CodeCompleteOptionsDialog"> <property name="can_focus">False</property> <property name="border_width">5</property> - <property name="title" translatable="yes">Autocomplete Options</property> + <property name="title" translatable="yes">IDE Options</property> <property name="resizable">False</property> <property name="modal">True</property> <property name="type_hint">dialog</property> @@ -92,6 +92,21 @@ <property name="position">0</property> </packing> </child> + <child> + <object class="GtkCheckButton" id="extendedtypes_enable"> + <property name="label" translatable="yes">Use extended types</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> </object> </child> </object> diff --git a/basic/Library_sb.mk b/basic/Library_sb.mk index b325a159bcb4..bf529a02f1ac 100644 --- a/basic/Library_sb.mk +++ b/basic/Library_sb.mk @@ -29,6 +29,10 @@ $(eval $(call gb_Library_set_include,sb,\ $(eval $(call gb_Library_use_external,sb,boost_headers)) +$(eval $(call gb_Library_use_custom_headers,sb,\ + officecfg/registry \ +)) + $(eval $(call gb_Library_use_sdk_api,sb)) $(eval $(call gb_Library_use_api,sb,oovbaapi)) diff --git a/basic/source/classes/codecompletecache.cxx b/basic/source/classes/codecompletecache.cxx index f48952f36394..57239ccc01f3 100644 --- a/basic/source/classes/codecompletecache.cxx +++ b/basic/source/classes/codecompletecache.cxx @@ -20,6 +20,7 @@ #include <basic/codecompletecache.hxx> #include <iostream> #include <rtl/instance.hxx> +#include <officecfg/Office/BasicIDE.hxx> namespace { @@ -27,12 +28,17 @@ namespace } CodeCompleteOptions::CodeCompleteOptions() -: bIsCodeCompleteOn( false ), +/*: bIsCodeCompleteOn( false ), bIsProcedureAutoCompleteOn( false ), bIsAutoCloseQuotesOn( false ), bIsAutoCloseParenthesisOn( false ), -bIsAutoCorrectSpellingOn( false ) +bIsAutoCorrectSpellingOn( false )*/ { + bIsAutoCorrectSpellingOn = officecfg::Office::BasicIDE::Autocomplete::AutoCorrectSpelling::get(); + bIsAutoCloseParenthesisOn = officecfg::Office::BasicIDE::Autocomplete::AutocloseParenthesis::get(); + bIsAutoCloseQuotesOn = officecfg::Office::BasicIDE::Autocomplete::AutocloseDoubleQuotes::get(); + bIsProcedureAutoCompleteOn = officecfg::Office::BasicIDE::Autocomplete::AutocloseProc::get(); + bIsCodeCompleteOn = officecfg::Office::BasicIDE::Autocomplete::CodeComplete::get(); } bool CodeCompleteOptions::IsCodeCompleteOn() @@ -50,6 +56,11 @@ bool CodeCompleteOptions::IsExtendedTypeDeclaration() return CodeCompleteOptions::IsCodeCompleteOn(); } +void CodeCompleteOptions::SetExtendedTypeDeclaration( const bool& b ) +{ + CodeCompleteOptions::SetCodeCompleteOn( b ); +} + bool CodeCompleteOptions::IsProcedureAutoCompleteOn() { return theCodeCompleteOptions::get().aMiscOptions.IsExperimentalMode() && theCodeCompleteOptions::get().bIsProcedureAutoCompleteOn; diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index 989f5f547dae..053c13ed5ede 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -1795,6 +1795,7 @@ void SbModule::GetCodeCompleteDataFromParse(CodeCompleteDataCache& aCache) for( sal_uInt16 i = 0; i < pPool->GetSize(); ++i ) { SbiSymDef* pSymDef = pPool->Get(i); + //std::cerr << "i: " << i << ", type: " << pSymDef->GetType() << std::endl; if( pSymDef->GetType() == SbxOBJECT ) { if( !pParser->aGblStrings.Find( pSymDef->GetTypeId() ).isEmpty() ) @@ -1809,6 +1810,7 @@ void SbModule::GetCodeCompleteDataFromParse(CodeCompleteDataCache& aCache) for(sal_uInt16 j = 0; j < pChildPool.GetSize(); ++j ) { SbiSymDef* pChildSymDef = pChildPool.Get(j); + //std::cerr << "j: " << j << ", type: " << pChildSymDef->GetType() << std::endl; if( pChildSymDef->GetType() == SbxOBJECT ) { if( !pParser->aGblStrings.Find( pChildSymDef->GetTypeId() ).isEmpty() ) diff --git a/include/basic/codecompletecache.hxx b/include/basic/codecompletecache.hxx index cb92a64320cf..10c2f7335e91 100644 --- a/include/basic/codecompletecache.hxx +++ b/include/basic/codecompletecache.hxx @@ -53,7 +53,9 @@ public: static bool IsCodeCompleteOn(); static void SetCodeCompleteOn( const bool& b ); + static bool IsExtendedTypeDeclaration(); + static void SetExtendedTypeDeclaration( const bool& b ); static bool IsProcedureAutoCompleteOn(); static void SetProcedureAutoCompleteOn( const bool& b ); @@ -66,7 +68,6 @@ public: static bool IsAutoCorrectSpellingOn(); static void SetAutoCorrectSpellingOn( const bool& b ); - }; class BASIC_DLLPUBLIC CodeCompleteDataCache diff --git a/officecfg/registry/schema/org/openoffice/Office/BasicIDE.xcs b/officecfg/registry/schema/org/openoffice/Office/BasicIDE.xcs index 1cce64415e26..385f746a7dca 100644 --- a/officecfg/registry/schema/org/openoffice/Office/BasicIDE.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/BasicIDE.xcs @@ -32,6 +32,12 @@ </info> <value>false</value> </prop> + <prop oor:name="UseExtended" oor:type="xs:boolean" oor:nillable="false"> + <info> + <desc>Sets the usage of extended types on/off. Default is false.</desc> + </info> + <value>false</value> + </prop> <prop oor:name="AutocloseParenthesis" oor:type="xs:boolean" oor:nillable="false"> <info> <desc>Sets the autoclose parenthesis on/off. Default is false.</desc> |