basctl/Library_basctl.mk | 1 basctl/UIConfig_basicide.mk | 1 basctl/source/basicide/baside2.cxx | 13 basctl/source/basicide/codecompleteoptionsdlg.cxx | 74 +++ basctl/source/basicide/codecompleteoptionsdlg.hxx | 54 ++ basctl/uiconfig/basicide/menubar/menubar.xml | 2 basctl/uiconfig/basicide/ui/codecompleteoptionsdlg.ui | 212 ++++++++++ basic/source/classes/codecompletecache.cxx | 21 basic/source/classes/sbxmod.cxx | 3 include/basic/codecompletecache.hxx | 4 officecfg/registry/data/org/openoffice/Office/UI/BasicIDECommands.xcu | 4 sfx2/sdi/sfx.sdi | 4 12 files changed, 371 insertions(+), 22 deletions(-)
New commits: commit c4373b6e3b07bbd0d633499da4e1afd692d03889 Author: Gergo Mocsi <gmocs...@gmail.com> Date: Tue Jul 23 23:00:55 2013 +0200 GSOC work, ModalDialog instead of menu entry Created a ModalDialog named CodeCompleteOptionsDlg to edit options for code completition/suggestion. Unimplemented features in it are disabled. The dialog window uses Glade .ui file. Change-Id: I1b59f386a9575aa25b38c5a1d7d1f020498a69ab diff --git a/basctl/Library_basctl.mk b/basctl/Library_basctl.mk index c008ad6..b609aae 100644 --- a/basctl/Library_basctl.mk +++ b/basctl/Library_basctl.mk @@ -99,6 +99,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/moduldl2 \ basctl/source/basicide/moduldlg \ basctl/source/basicide/objdlg \ diff --git a/basctl/UIConfig_basicide.mk b/basctl/UIConfig_basicide.mk index 013df6e..624f426 100644 --- a/basctl/UIConfig_basicide.mk +++ b/basctl/UIConfig_basicide.mk @@ -30,6 +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 \ )) # vim: set noet sw=4 ts=4: diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx index 1fff14a..bc24c57 100644 --- a/basctl/source/basicide/baside2.cxx +++ b/basctl/source/basicide/baside2.cxx @@ -54,6 +54,7 @@ #include <cassert> #include <basic/codecompletecache.hxx> #include <svtools/miscopt.hxx> +#include "codecompleteoptionsdlg.hxx" namespace basctl { @@ -1013,8 +1014,8 @@ void ModulWindow::ExecuteCommand (SfxRequest& rReq) break; case SID_BASICIDE_CODECOMPLETITION: { - SFX_REQUEST_ARG(rReq, pItem, SfxBoolItem, rReq.GetSlot(), false); - CodeCompleteOptions::SetCodeCompleteOn( pItem && pItem->GetValue() ); + boost::scoped_ptr< CodeCompleteOptionsDlg > pDlg( new CodeCompleteOptionsDlg( this ) ); + pDlg->Execute(); } break; case SID_CUT: @@ -1166,15 +1167,9 @@ void ModulWindow::GetState( SfxItemSet &rSet ) case SID_BASICIDE_CODECOMPLETITION: { SvtMiscOptions aMiscOptions; - if( aMiscOptions.IsExperimentalMode() ) - { - rSet.Put(SfxBoolItem( nWh, CodeCompleteOptions::IsCodeCompleteOn() )); - std::cerr <<"code complete set to: " << CodeCompleteOptions::IsCodeCompleteOn() << std::endl; - } - else + if( !aMiscOptions.IsExperimentalMode() ) { rSet.Put( SfxVisibilityItem(nWh, false) ); - //CodeCompleteOptions::SetCodeCompleteOn( false ); } } break; diff --git a/basctl/source/basicide/codecompleteoptionsdlg.cxx b/basctl/source/basicide/codecompleteoptionsdlg.cxx new file mode 100644 index 0000000..a948ab6 --- /dev/null +++ b/basctl/source/basicide/codecompleteoptionsdlg.cxx @@ -0,0 +1,74 @@ +/* -*- 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 <basic/codecompletecache.hxx> +#include <svtools/miscopt.hxx> +#include <basidesh.hrc> +#include <iostream> + +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(pAutocloseBracesChk, "autoclose_braces"); + get(pAutocloseQuotesChk, "autoclose_quotes"); + + pOkBtn->SetClickHdl( LINK( this, CodeCompleteOptionsDlg, OkHdl ) ); + pCancelBtn->SetClickHdl( LINK( this, CodeCompleteOptionsDlg, CancelHdl ) ); + + pCodeCompleteChk->Check(CodeCompleteOptions::IsCodeCompleteOn()); //set it on, if needed + + pAutocloseProcChk->Enable( false ); + pAutocloseBracesChk->Enable( false ); + pAutocloseQuotesChk->Enable( false ); +} + +CodeCompleteOptionsDlg::~CodeCompleteOptionsDlg() +{ +} + +IMPL_LINK_NOARG(CodeCompleteOptionsDlg, OkHdl) +{ + CodeCompleteOptions::SetCodeCompleteOn( pCodeCompleteChk->IsChecked() ); + Close(); + return 0; +} + +IMPL_LINK_NOARG(CodeCompleteOptionsDlg, CancelHdl) +{ + Close(); + return 0; +} + +short CodeCompleteOptionsDlg::Execute() +{ + return ModalDialog::Execute(); +} + +} // namespace basctl + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/codecompleteoptionsdlg.hxx b/basctl/source/basicide/codecompleteoptionsdlg.hxx new file mode 100644 index 0000000..9549b99 --- /dev/null +++ b/basctl/source/basicide/codecompleteoptionsdlg.hxx @@ -0,0 +1,54 @@ +/* -*- 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_CODECOMPLETEOPTIONSDLG_HXX +#define BASCTL_CODECOMPLETEOPTIONSDLG_HXX + +#include <vcl/button.hxx> +#include <vcl/dialog.hxx> + +namespace basctl +{ + +class CodeCompleteOptionsDlg: public ModalDialog +{ +private: + CancelButton* pCancelBtn; + OKButton* pOkBtn; + + CheckBox* pCodeCompleteChk; + CheckBox* pAutocloseProcChk; + CheckBox* pAutocloseBracesChk; + CheckBox* pAutocloseQuotesChk; + + DECL_LINK(OkHdl, void*); + DECL_LINK(CancelHdl, void*); + +public: + CodeCompleteOptionsDlg( Window* pWindow ); + ~CodeCompleteOptionsDlg(); + + virtual short Execute(); +}; + +} // namespace basctl + +#endif //BASCTL_CODECOMPLETEOPTIONSDLG_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/uiconfig/basicide/menubar/menubar.xml b/basctl/uiconfig/basicide/menubar/menubar.xml index 2e16130..2bb4220 100644 --- a/basctl/uiconfig/basicide/menubar/menubar.xml +++ b/basctl/uiconfig/basicide/menubar/menubar.xml @@ -61,7 +61,7 @@ <menu:menuitem menu:id=".uno:StatusBarVisible"/> <menu:menuitem menu:id=".uno:ShowImeStatusWindow"/> <menu:menuitem menu:id=".uno:ShowLines"/> - <menu:menuitem menu:id=".uno:BasicCodeCompletition"/> + <menu:menuitem menu:id=".uno:CodeCompleteOptionsDialog"/> <menu:menuitem menu:id=".uno:GotoLine"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:FullScreen"/> diff --git a/basctl/uiconfig/basicide/ui/codecompleteoptionsdlg.ui b/basctl/uiconfig/basicide/ui/codecompleteoptionsdlg.ui new file mode 100644 index 0000000..83256b5 --- /dev/null +++ b/basctl/uiconfig/basicide/ui/codecompleteoptionsdlg.ui @@ -0,0 +1,212 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + <!-- interface-requires gtk+ 3.0 --> + <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="resizable">False</property> + <property name="modal">True</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">2</property> + <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="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">0</property> + </packing> + </child> + <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="receives_default">True</property> + <property name="use_stock">True</property> + <property name="image_position">right</property> + <property name="has_default">True</property> + <property name="can_default">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">0</property> + </packing> + </child> + <child> + <object class="GtkBox" id="box1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <child> + <object class="GtkFrame" id="frame1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="left_padding">12</property> + <child> + <object class="GtkBox" id="box3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <child> + <object class="GtkCheckButton" id="codecomplete_enable"> + <property name="label" translatable="yes">Enable Code Completition</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">0</property> + </packing> + </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Code Completition</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkFrame" id="frame2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="left_padding">12</property> + <child> + <object class="GtkBox" id="box4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <child> + <object class="GtkCheckButton" id="autoclose_proc"> + <property name="label" translatable="yes">Autoclose Procedures</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">0</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="autoclose_braces"> + <property name="label" translatable="yes">Autoclose Braces</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> + <child> + <object class="GtkCheckButton" id="autoclose_quotes"> + <property name="label" translatable="yes">Autoclose Quotes</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">2</property> + </packing> + </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="label2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Code Suggestion</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </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="position">1</property> + </packing> + </child> + </object> + </child> + <action-widgets> + <action-widget response="-1">cancel</action-widget> + <action-widget response="0">ok</action-widget> + </action-widgets> + </object> +</interface> diff --git a/basic/source/classes/codecompletecache.cxx b/basic/source/classes/codecompletecache.cxx index 77a0204..3898eb2 100644 --- a/basic/source/classes/codecompletecache.cxx +++ b/basic/source/classes/codecompletecache.cxx @@ -30,24 +30,19 @@ namespace } CodeCompleteOptions::CodeCompleteOptions() -: bIsCodeCompleteOn( false ) +: bIsCodeCompleteOn( false ), +bIsProcedureAutoCompleteOn( false ) { } bool CodeCompleteOptions::IsCodeCompleteOn() { - /*if( !theCodeCompleteOptions::get().aMiscOptions.IsExperimentalMode() ) - return false; - else*/ return theCodeCompleteOptions::get().aMiscOptions.IsExperimentalMode() && theCodeCompleteOptions::get().bIsCodeCompleteOn; } void CodeCompleteOptions::SetCodeCompleteOn( const bool& b ) { - if( !theCodeCompleteOptions::get().aMiscOptions.IsExperimentalMode() ) - theCodeCompleteOptions::get().bIsCodeCompleteOn = false; - else - theCodeCompleteOptions::get().bIsCodeCompleteOn = b; + theCodeCompleteOptions::get().bIsCodeCompleteOn = b; } bool CodeCompleteOptions::IsExtendedTypeDeclaration() @@ -55,6 +50,16 @@ bool CodeCompleteOptions::IsExtendedTypeDeclaration() return CodeCompleteOptions::IsCodeCompleteOn(); } +bool CodeCompleteOptions::IsProcedureAutoCompleteOn() +{ + return theCodeCompleteOptions::get().aMiscOptions.IsExperimentalMode() && theCodeCompleteOptions::get().bIsProcedureAutoCompleteOn; +} + +void CodeCompleteOptions::SetProcedureAutoCompleteOn( const bool& b ) +{ + theCodeCompleteOptions::get().bIsProcedureAutoCompleteOn = b; +} + std::ostream& operator<< (std::ostream& aStream, const CodeCompleteDataCache& aCache) { for( CodeCompleteVarScopes::const_iterator aIt = aCache.aVarScopes.begin(); aIt != aCache.aVarScopes.end(); ++aIt ) diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index 8182f6e..cbe5886 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -671,7 +671,10 @@ void SbModule::EndDefinitions( sal_Bool bNewState ) if( p ) { if( p->bInvalid ) + { + std::cerr << "invalid definition: " << p->GetName() << std::endl; pMethods->Remove( p ); + } else { p->bInvalid = bNewState; diff --git a/include/basic/codecompletecache.hxx b/include/basic/codecompletecache.hxx index 9033b89..57ed673 100644 --- a/include/basic/codecompletecache.hxx +++ b/include/basic/codecompletecache.hxx @@ -41,6 +41,7 @@ class BASIC_DLLPUBLIC CodeCompleteOptions * */ private: bool bIsCodeCompleteOn; + bool bIsProcedureAutoCompleteOn; SvtMiscOptions aMiscOptions; public: @@ -49,6 +50,9 @@ public: static bool IsCodeCompleteOn(); static void SetCodeCompleteOn( const bool& b ); static bool IsExtendedTypeDeclaration(); + + static bool IsProcedureAutoCompleteOn(); + static void SetProcedureAutoCompleteOn( const bool& b ); }; class BASIC_DLLPUBLIC CodeCompleteDataCache diff --git a/officecfg/registry/data/org/openoffice/Office/UI/BasicIDECommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/BasicIDECommands.xcu index 88bca68..f318952 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/BasicIDECommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/BasicIDECommands.xcu @@ -8,9 +8,9 @@ <value xml:lang="en-US">Goto Line Number...</value> </prop> </node> - <node oor:name=".uno:BasicCodeCompletition" oor:op="replace"> + <node oor:name=".uno:CodeCompleteOptionsDialog" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> - <value xml:lang="en-US">Enable Code Completition</value> + <value xml:lang="en-US">Code Completition Options</value> </prop> </node> <node oor:name=".uno:ShowLines" oor:op="replace"> diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi index 576e7fb..df9f858 100644 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -3874,7 +3874,7 @@ SfxVoidItem MatchGroup SID_BASICIDE_MATCHGROUP GroupId = GID_MACRO; ] -SfxBoolItem BasicCodeCompletition SID_BASICIDE_CODECOMPLETITION +SfxVoidItem CodeCompleteOptionsDialog SID_BASICIDE_CODECOMPLETITION [ /* flags: */ @@ -3884,7 +3884,7 @@ SfxBoolItem BasicCodeCompletition SID_BASICIDE_CODECOMPLETITION HasCoreId = FALSE, HasDialog = FALSE, ReadOnlyDoc = TRUE, - Toggle = TRUE, + Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, RecordPerSet; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits