From 790a7aff12eb37c76484026bd77915cef3de98d4 Mon Sep 17 00:00:00 2001 From: Gergo Mocsi Date: Thu, 1 Aug 2013 13:59:10 +0200 Subject: GSOC work, renaming for consistency Menu enrty was renamed to IDE Options under View. SID_BASICIDE_CODECOMPLETE was renamed to SID_BASICIDE_IDEOPTIONS. CodeCompleteDlg was rename to BasicIDEOptionDlg. Ui file was renamed to basicideoptionsdialog.ui. Checkbox for extended types is now independent from code complete one. Change-Id: Id862df0ee56cdf2aa81e19a34099fe679ad5d311 --- basctl/Library_basctl.mk | 2 +- basctl/UIConfig_basicide.mk | 2 +- basctl/sdi/baside.sdi | 2 +- basctl/source/basicide/basicideoptionsdlg.cxx | 111 ++++++++ basctl/source/basicide/basicideoptionsdlg.hxx | 59 +++++ basctl/source/basicide/baside2.cxx | 8 +- basctl/source/basicide/baside2b.cxx | 5 +- basctl/source/basicide/codecompleteoptionsdlg.cxx | 126 ---------- basctl/uiconfig/basicide/menubar/menubar.xml | 2 +- .../uiconfig/basicide/ui/basicideoptionsdialog.ui | 279 +++++++++++++++++++++ 10 files changed, 459 insertions(+), 137 deletions(-) create mode 100644 basctl/source/basicide/basicideoptionsdlg.cxx create mode 100644 basctl/source/basicide/basicideoptionsdlg.hxx delete mode 100644 basctl/source/basicide/codecompleteoptionsdlg.cxx create mode 100644 basctl/uiconfig/basicide/ui/basicideoptionsdialog.ui (limited to 'basctl') diff --git a/basctl/Library_basctl.mk b/basctl/Library_basctl.mk index 480023041cbb..9e4b94e36719 100644 --- a/basctl/Library_basctl.mk +++ b/basctl/Library_basctl.mk @@ -90,7 +90,7 @@ $(eval $(call gb_Library_add_exception_objects,basctl,\ basctl/source/basicide/linenumberwindow \ basctl/source/basicide/localizationmgr \ basctl/source/basicide/macrodlg \ - basctl/source/basicide/codecompleteoptionsdlg \ + basctl/source/basicide/basicideoptionsdlg \ basctl/source/basicide/moduldl2 \ basctl/source/basicide/moduldlg \ basctl/source/basicide/objdlg \ diff --git a/basctl/UIConfig_basicide.mk b/basctl/UIConfig_basicide.mk index 624f42683072..4be0d4d38b78 100644 --- a/basctl/UIConfig_basicide.mk +++ b/basctl/UIConfig_basicide.mk @@ -30,7 +30,7 @@ $(eval $(call gb_UIConfig_add_toolbarfiles,modules/BasicIDE,\ $(eval $(call gb_UIConfig_add_uifiles,modules/BasicIDE,\ basctl/uiconfig/basicide/ui/basicmacrodialog \ - basctl/uiconfig/basicide/ui/codecompleteoptionsdlg \ + basctl/uiconfig/basicide/ui/basicideoptionsdialog \ )) # vim: set noet sw=4 ts=4: diff --git a/basctl/sdi/baside.sdi b/basctl/sdi/baside.sdi index 42873f6cd303..b00b65ec9e3e 100644 --- a/basctl/sdi/baside.sdi +++ b/basctl/sdi/baside.sdi @@ -36,7 +36,7 @@ shell basctl_Shell ExecMethod = ExecuteCurrent; ] - SID_BASICIDE_CODECOMPLETITION + SID_BASICIDE_IDEOPTIONS [ StateMethod = GetState; ExecMethod = ExecuteCurrent; diff --git a/basctl/source/basicide/basicideoptionsdlg.cxx b/basctl/source/basicide/basicideoptionsdlg.cxx new file mode 100644 index 000000000000..765cffa3ca84 --- /dev/null +++ b/basctl/source/basicide/basicideoptionsdlg.cxx @@ -0,0 +1,111 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "basicideoptionsdlg.hxx" +#include +#include +#include +#include +#include +#include + +namespace basctl +{ + +BasicIDEOptionsDlg::BasicIDEOptionsDlg( Window* pWindow ) +: ModalDialog(pWindow, "BasicIDEOptionsDlg", "modules/BasicIDE/ui/basicideoptionsdialog.ui") +{ + get(pCancelBtn, "cancel"); + get(pOkBtn, "ok"); + + get(pCodeCompleteChk, "codecomplete_enable"); + get(pAutocloseProcChk, "autoclose_proc"); + get(pAutocloseParenChk, "autoclose_paren"); + get(pAutocloseQuotesChk, "autoclose_quotes"); + get(pAutoCorrectKeywordsChk, "autocorrect_keywords"); + get(pUseExtendedTypesChk, "extendedtypes_enable"); + + pOkBtn->SetClickHdl( LINK( this, BasicIDEOptionsDlg, OkHdl ) ); + pCancelBtn->SetClickHdl( LINK( this, BasicIDEOptionsDlg, CancelHdl ) ); + + LoadConfig(); + +} + +BasicIDEOptionsDlg::~BasicIDEOptionsDlg() +{ +} + +IMPL_LINK_NOARG(BasicIDEOptionsDlg, OkHdl) +{ + CodeCompleteOptions::SetCodeCompleteOn( pCodeCompleteChk->IsChecked() ); + CodeCompleteOptions::SetProcedureAutoCompleteOn( pAutocloseProcChk->IsChecked() ); + CodeCompleteOptions::SetAutoCloseQuotesOn( pAutocloseQuotesChk->IsChecked() ); + CodeCompleteOptions::SetAutoCloseParenthesisOn( pAutocloseParenChk->IsChecked() ); + CodeCompleteOptions::SetAutoCorrectKeywordsOn( pAutoCorrectKeywordsChk->IsChecked() ); + CodeCompleteOptions::SetExtendedTypeDeclaration( pUseExtendedTypesChk->IsChecked() ); + + SaveConfig(); + Close(); + return 0; +} + +IMPL_LINK_NOARG(BasicIDEOptionsDlg, CancelHdl) +{ + Close(); + return 0; +} + +short BasicIDEOptionsDlg::Execute() +{ + return ModalDialog::Execute(); +} + +void BasicIDEOptionsDlg::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(); + bool bCorrect = officecfg::Office::BasicIDE::Autocomplete::AutoCorrectKeywords::get(); + + pCodeCompleteChk->Check( bCodeCompleteOn ); + pAutocloseProcChk->Check( bProcClose ); + pAutocloseQuotesChk->Check( bQuoteClose ); + pAutocloseParenChk->Check( bParenClose ); + pAutoCorrectKeywordsChk->Check( bCorrect ); + pUseExtendedTypesChk->Check( bExtended ); +} + +void BasicIDEOptionsDlg::SaveConfig() +{ + 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::AutoCorrectKeywords::set( pAutoCorrectKeywordsChk->IsChecked(), batch ); + batch->commit(); +} + +} // namespace basctl + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/basicideoptionsdlg.hxx b/basctl/source/basicide/basicideoptionsdlg.hxx new file mode 100644 index 000000000000..1d3970daa314 --- /dev/null +++ b/basctl/source/basicide/basicideoptionsdlg.hxx @@ -0,0 +1,59 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef BASCTL_BASICIDEOPTIONSDLG_HXX +#define BASCTL_BASICIDEOPTIONSDLG_HXX + +#include +#include + +namespace basctl +{ + +class BasicIDEOptionsDlg: public ModalDialog +{ +private: + CancelButton* pCancelBtn; + OKButton* pOkBtn; + + CheckBox* pCodeCompleteChk; + CheckBox* pAutocloseProcChk; + CheckBox* pAutocloseParenChk; + CheckBox* pAutocloseQuotesChk; + CheckBox* pAutoCorrectKeywordsChk; + CheckBox* pUseExtendedTypesChk; + + DECL_LINK(OkHdl, void*); + DECL_LINK(CancelHdl, void*); + + void LoadConfig(); + void SaveConfig(); + +public: + BasicIDEOptionsDlg( Window* pWindow ); + ~BasicIDEOptionsDlg(); + + virtual short Execute(); +}; + +} // namespace basctl + +#endif //BASCTL_BASICIDEOPTIONSDLG_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx index ef7c5c9eb75b..ae17932dc48f 100644 --- a/basctl/source/basicide/baside2.cxx +++ b/basctl/source/basicide/baside2.cxx @@ -54,7 +54,7 @@ #include #include #include -#include "codecompleteoptionsdlg.hxx" +#include "basicideoptionsdlg.hxx" namespace basctl { @@ -1012,9 +1012,9 @@ void ModulWindow::ExecuteCommand (SfxRequest& rReq) rLayout.BasicRemoveWatch(); } break; - case SID_BASICIDE_CODECOMPLETITION: + case SID_BASICIDE_IDEOPTIONS: { - boost::scoped_ptr< CodeCompleteOptionsDlg > pDlg( new CodeCompleteOptionsDlg( this ) ); + boost::scoped_ptr< BasicIDEOptionsDlg > pDlg( new BasicIDEOptionsDlg( this ) ); pDlg->Execute(); } break; @@ -1164,7 +1164,7 @@ void ModulWindow::GetState( SfxItemSet &rSet ) rSet.Put(SfxBoolItem(nWh, bSourceLinesEnabled)); break; } - case SID_BASICIDE_CODECOMPLETITION: + case SID_BASICIDE_IDEOPTIONS: { SvtMiscOptions aMiscOptions; if( !aMiscOptions.IsExperimentalMode() ) diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index 7349e8649fc6..4cd4258dcc12 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -510,7 +510,7 @@ void EditorWindow::KeyInput( const KeyEvent& rKEvt ) if( (rKEvt.GetKeyCode().GetCode() == KEY_SPACE || rKEvt.GetKeyCode().GetCode() == KEY_TAB || - rKEvt.GetKeyCode().GetCode() == KEY_RETURN ) && CodeCompleteOptions::IsAutoCorrectSpellingOn() ) + rKEvt.GetKeyCode().GetCode() == KEY_RETURN ) && CodeCompleteOptions::IsAutoCorrectKeywordsOn() ) { TextSelection aSel = GetEditView()->GetSelection(); sal_uLong nLine = aSel.GetStart().GetPara(); @@ -611,7 +611,6 @@ void EditorWindow::KeyInput( const KeyEvent& rKEvt ) if( nLine+1 == pEditEngine->GetParagraphCount() ) { //append to the end OUString sText("\nEnd "); - std::cerr << "sProcType: " << sProcType << std::endl; if( sProcType.equalsIgnoreAsciiCase("function") ) sText += OUString( "Function\n" ); if( sProcType.equalsIgnoreAsciiCase("sub") ) @@ -686,7 +685,7 @@ void EditorWindow::KeyInput( const KeyEvent& rKEvt ) OUString sBaseName = aVect[0];//variable name OUString sVarType = aCodeCompleteCache.GetVarType( sBaseName ); - if( !sVarType.isEmpty() && CodeCompleteOptions::IsAutoCorrectSpellingOn() )//correct variable name + if( !sVarType.isEmpty() && CodeCompleteOptions::IsAutoCorrectKeywordsOn() )//correct variable name { TextPaM aStart(nLine, aSel.GetStart().GetIndex() - sBaseName.getLength() ); TextSelection sTextSelection(aStart, TextPaM(nLine, aSel.GetStart().GetIndex())); diff --git a/basctl/source/basicide/codecompleteoptionsdlg.cxx b/basctl/source/basicide/codecompleteoptionsdlg.cxx deleted file mode 100644 index e8537c616528..000000000000 --- a/basctl/source/basicide/codecompleteoptionsdlg.cxx +++ /dev/null @@ -1,126 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "codecompleteoptionsdlg.hxx" -#include -#include -#include -#include -#include -#include - -namespace basctl -{ - -CodeCompleteOptionsDlg::CodeCompleteOptionsDlg( Window* pWindow ) -: ModalDialog(pWindow, "CodeCompleteOptionsDialog", "modules/BasicIDE/ui/codecompleteoptionsdlg.ui") -{ - get(pCancelBtn, "cancel"); - get(pOkBtn, "ok"); - - get(pCodeCompleteChk, "codecomplete_enable"); - get(pAutocloseProcChk, "autoclose_proc"); - 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 ) ); - - pCodeCompleteChk->SetToggleHdl( LINK(this, CodeCompleteOptionsDlg, CodeCompleteHdl) ); - pUseExtendedTypesChk->SetToggleHdl( LINK(this, CodeCompleteOptionsDlg, ExtendedTypesHdl) ); - - LoadConfig(); - -} - -CodeCompleteOptionsDlg::~CodeCompleteOptionsDlg() -{ -} - -IMPL_LINK_NOARG(CodeCompleteOptionsDlg, OkHdl) -{ - CodeCompleteOptions::SetCodeCompleteOn( pCodeCompleteChk->IsChecked() ); - CodeCompleteOptions::SetProcedureAutoCompleteOn( pAutocloseProcChk->IsChecked() ); - CodeCompleteOptions::SetAutoCloseQuotesOn( pAutocloseQuotesChk->IsChecked() ); - CodeCompleteOptions::SetAutoCloseParenthesisOn( pAutocloseParenChk->IsChecked() ); - CodeCompleteOptions::SetAutoCorrectSpellingOn( pAutoCorrectSpellingChk->IsChecked() ); - CodeCompleteOptions::SetExtendedTypeDeclaration( pAutoCorrectSpellingChk->IsChecked() ); - - SaveConfig(); - Close(); - return 0; -} - -IMPL_LINK_NOARG(CodeCompleteOptionsDlg, CancelHdl) -{ - Close(); - 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(); -} - -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(); - bool bCorrect = officecfg::Office::BasicIDE::Autocomplete::AutoCorrectSpelling::get(); - - pCodeCompleteChk->Check( bCodeCompleteOn ); - pAutocloseProcChk->Check( bProcClose ); - pAutocloseQuotesChk->Check( bQuoteClose ); - pAutocloseParenChk->Check( bParenClose ); - pAutoCorrectSpellingChk->Check( bCorrect ); - pUseExtendedTypesChk->Check( bExtended ); -} - -void CodeCompleteOptionsDlg::SaveConfig() -{ - 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 ); - batch->commit(); -} - -} // namespace basctl - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/uiconfig/basicide/menubar/menubar.xml b/basctl/uiconfig/basicide/menubar/menubar.xml index 2bb4220ca28d..34288e2786fd 100644 --- a/basctl/uiconfig/basicide/menubar/menubar.xml +++ b/basctl/uiconfig/basicide/menubar/menubar.xml @@ -61,7 +61,7 @@ - + diff --git a/basctl/uiconfig/basicide/ui/basicideoptionsdialog.ui b/basctl/uiconfig/basicide/ui/basicideoptionsdialog.ui new file mode 100644 index 000000000000..e293ccd43f63 --- /dev/null +++ b/basctl/uiconfig/basicide/ui/basicideoptionsdialog.ui @@ -0,0 +1,279 @@ + + + + + False + 5 + IDE Options + False + True + dialog + + + False + vertical + 2 + + + True + False + 0 + none + + + True + False + 12 + + + True + False + vertical + + + Use extended types + True + True + False + 0 + True + + + False + True + 0 + + + + + + + + + True + False + Language Features + + + + + + + + False + True + 0 + + + + + False + end + + + gtk-cancel + True + True + True + True + + + False + True + 0 + + + + + gtk-ok + True + True + True + True + True + True + right + + + False + True + 1 + + + + + False + True + end + 0 + + + + + True + False + vertical + + + True + False + 0 + none + + + True + False + 12 + + + True + False + vertical + + + Enable Code Completition + True + True + False + 0 + True + + + False + True + 0 + + + + + + + + + True + False + Code Completition + + + + + + + + False + True + 0 + + + + + True + False + 0 + none + + + True + False + 12 + + + True + False + vertical + + + Autoclose Procedures + True + True + False + 0 + True + + + False + True + 0 + + + + + Autoclose Parenthesis + True + True + False + 0 + True + + + False + True + 1 + + + + + Autoclose Quotes + True + True + False + 0 + True + + + False + True + 2 + + + + + Autocorrect Keywords + True + True + False + 0 + True + + + False + True + 3 + + + + + + + + + True + False + Code Suggestion + + + + + + + + False + True + 1 + + + + + False + True + 1 + + + + + + cancel + ok + + + -- cgit