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

the stock multilineedit is sufficient IMO

Change-Id: I374c17fcda80c4f821271bf665a41beae100cccf
üst 1908f27d
...@@ -56,7 +56,6 @@ endif ...@@ -56,7 +56,6 @@ endif
$(eval $(call gb_Library_set_componentfile,deploymentgui,desktop/source/deployment/gui/deploymentgui)) $(eval $(call gb_Library_set_componentfile,deploymentgui,desktop/source/deployment/gui/deploymentgui))
$(eval $(call gb_Library_add_exception_objects,deploymentgui,\ $(eval $(call gb_Library_add_exception_objects,deploymentgui,\
desktop/source/deployment/gui/dp_gui_autoscrolledit \
desktop/source/deployment/gui/dp_gui_dependencydialog \ desktop/source/deployment/gui/dp_gui_dependencydialog \
desktop/source/deployment/gui/dp_gui_dialog2 \ desktop/source/deployment/gui/dp_gui_dialog2 \
desktop/source/deployment/gui/dp_gui_extensioncmdqueue \ desktop/source/deployment/gui/dp_gui_extensioncmdqueue \
......
/* -*- 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 "svtools/svmedit2.hxx"
#include "svl/lstner.hxx"
#include "vcl/xtextedt.hxx"
#include "vcl/scrbar.hxx"
#include "vcl/builder.hxx"
#include "dp_gui_autoscrolledit.hxx"
namespace dp_gui {
AutoScrollEdit::AutoScrollEdit( Window* pParent, WinBits nWinStyle )
: ExtMultiLineEdit( pParent, nWinStyle )
{
ScrollBar* pScroll = GetVScrollBar();
if (pScroll)
pScroll->Hide();
StartListening( *GetTextEngine() );
}
AutoScrollEdit::~AutoScrollEdit()
{
EndListeningAll();
}
void AutoScrollEdit::Notify( SfxBroadcaster&, const SfxHint& rHint )
{
if ( rHint.IsA( TYPE(TextHint) ) )
{
sal_uLong nId = ((const TextHint&)rHint).GetId();
if ( nId == TEXT_HINT_VIEWSCROLLED )
{
ScrollBar* pScroll = GetVScrollBar();
if ( pScroll )
pScroll->Show();
}
}
}
} // namespace dp_gui
extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeAutoScrollEdit(Window *pParent, VclBuilder::stringmap &)
{
return new dp_gui::AutoScrollEdit(pParent, WB_BORDER);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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 INCLUDED_DESKTOP_SOURCE_DEPLOYMENT_GUI_DP_GUI_AUTOSCROLLEDIT_HXX
#define INCLUDED_DESKTOP_SOURCE_DEPLOYMENT_GUI_DP_GUI_AUTOSCROLLEDIT_HXX
#include "svtools/svmedit2.hxx"
#include "svl/lstner.hxx"
namespace dp_gui {
/** This control shows automatically the vertical scroll bar if text is inserted,
that does not fit into the text area. In the resource one uses MultiLineEdit
and needs to set VScroll = TRUE
*/
class AutoScrollEdit : public ExtMultiLineEdit, public SfxListener
{
public:
AutoScrollEdit( Window* pParent, WinBits nWinStyle);
virtual ~AutoScrollEdit();
using ExtMultiLineEdit::Notify;
virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
};
} // namespace dp_gui
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -138,9 +138,9 @@ static const sal_uInt16 CMD_IGNORE_ALL_UPDATES = 3; ...@@ -138,9 +138,9 @@ static const sal_uInt16 CMD_IGNORE_ALL_UPDATES = 3;
enum Kind { ENABLED_UPDATE, DISABLED_UPDATE, SPECIFIC_ERROR }; enum Kind { ENABLED_UPDATE, DISABLED_UPDATE, SPECIFIC_ERROR };
OUString confineToParagraph(OUString const & text) { OUString confineToParagraph(OUString const & text) {
// Confine arbitrary text to a single paragraph in a dp_gui::AutoScrollEdit. // Confine arbitrary text to a single paragraph in a VclMultiLineEdit
// This assumes that U+000A and U+000D are the only paragraph separators in // This assumes that U+000A and U+000D are the only paragraph separators in
// a dp_gui::AutoScrollEdit, and that replacing them with a single space // a VclMultiLineEdit, and that replacing them with a single space
// each is acceptable: // each is acceptable:
return text.replace(LF, ' ').replace(CR, ' '); return text.replace(LF, ' ').replace(CR, ' ');
} }
......
...@@ -225,6 +225,8 @@ UpdateInstallDialog::UpdateInstallDialog( ...@@ -225,6 +225,8 @@ UpdateInstallDialog::UpdateInstallDialog(
get(m_pStatusbar, "STATUSBAR"); get(m_pStatusbar, "STATUSBAR");
get(m_pFt_extension_name, "EXTENSION_NAME"); get(m_pFt_extension_name, "EXTENSION_NAME");
get(m_pMle_info, "INFO"); get(m_pMle_info, "INFO");
m_pMle_info->set_height_request(m_pMle_info->GetTextHeight() * 5);
m_pMle_info->set_width_request(m_pMle_info->approximate_char_width() * 56);
get(m_pHelp, "HELP"); get(m_pHelp, "HELP");
get(m_pOk, "OK"); get(m_pOk, "OK");
get(m_pCancel, "CANCEL"); get(m_pCancel, "CANCEL");
...@@ -232,7 +234,6 @@ UpdateInstallDialog::UpdateInstallDialog( ...@@ -232,7 +234,6 @@ UpdateInstallDialog::UpdateInstallDialog(
m_xExtensionManager = css::deployment::ExtensionManager::get( xCtx ); m_xExtensionManager = css::deployment::ExtensionManager::get( xCtx );
m_pCancel->SetClickHdl(LINK(this, UpdateInstallDialog, cancelHandler)); m_pCancel->SetClickHdl(LINK(this, UpdateInstallDialog, cancelHandler));
m_pMle_info->EnableCursor(false);
if ( ! dp_misc::office_is_running()) if ( ! dp_misc::office_is_running())
m_pHelp->Disable(); m_pHelp->Disable();
} }
...@@ -255,7 +256,7 @@ short UpdateInstallDialog::Execute() ...@@ -255,7 +256,7 @@ short UpdateInstallDialog::Execute()
void UpdateInstallDialog::updateDone() void UpdateInstallDialog::updateDone()
{ {
if (!m_bError) if (!m_bError)
m_pMle_info->InsertText(m_sNoErrors); m_pMle_info->SetText(m_pMle_info->GetText() + m_sNoErrors);
m_pOk->Enable(); m_pOk->Enable();
m_pOk->GrabFocus(); m_pOk->GrabFocus();
m_pCancel->Disable(); m_pCancel->Disable();
...@@ -284,26 +285,28 @@ void UpdateInstallDialog::setError(INSTALL_ERROR err, OUString const & sExtensio ...@@ -284,26 +285,28 @@ void UpdateInstallDialog::setError(INSTALL_ERROR err, OUString const & sExtensio
OSL_ASSERT(false); OSL_ASSERT(false);
} }
OUString sMsg(m_pMle_info->GetText());
sError = sError.replaceFirst("%NAME", sExtension); sError = sError.replaceFirst("%NAME", sExtension);
//We want to have an empty line between the error messages. However, //We want to have an empty line between the error messages. However,
//there shall be no empty line after the last entry. //there shall be no empty line after the last entry.
if (m_bNoEntry) if (m_bNoEntry)
m_bNoEntry = false; m_bNoEntry = false;
else else
m_pMle_info->InsertText(OUString("\n")); sMsg += "\n";
m_pMle_info->InsertText(sError); sMsg += sError;
//Insert more information about the error //Insert more information about the error
if (!exceptionMessage.isEmpty()) if (!exceptionMessage.isEmpty())
m_pMle_info->InsertText(m_sThisErrorOccurred + exceptionMessage + "\n"); sMsg += m_sThisErrorOccurred + exceptionMessage + "\n";
m_pMle_info->InsertText(m_sNoInstall); sMsg += m_sNoInstall + "\n";
m_pMle_info->InsertText(OUString("\n"));
m_pMle_info->SetText(sMsg);
} }
void UpdateInstallDialog::setError(OUString const & exceptionMessage) void UpdateInstallDialog::setError(OUString const & exceptionMessage)
{ {
m_bError = true; m_bError = true;
m_pMle_info->InsertText(exceptionMessage + "\n"); m_pMle_info->SetText(m_pMle_info->GetText() + exceptionMessage + "\n");
} }
IMPL_LINK_NOARG(UpdateInstallDialog, cancelHandler) IMPL_LINK_NOARG(UpdateInstallDialog, cancelHandler)
......
...@@ -25,12 +25,11 @@ ...@@ -25,12 +25,11 @@
#include "vcl/fixed.hxx" #include "vcl/fixed.hxx"
#include "vcl/dialog.hxx" #include "vcl/dialog.hxx"
#include "vcl/prgsbar.hxx" #include "vcl/prgsbar.hxx"
#include "vcl/vclmedit.hxx"
#include "rtl/ref.hxx" #include "rtl/ref.hxx"
#include <vector> #include <vector>
#include "dp_gui_autoscrolledit.hxx"
/// @HTML /// @HTML
namespace com { namespace sun { namespace star { namespace deployment { namespace com { namespace sun { namespace star { namespace deployment {
class XExtensionManager; class XExtensionManager;
}}}} }}}}
...@@ -109,15 +108,12 @@ private: ...@@ -109,15 +108,12 @@ private:
FixedText *m_pFt_action; FixedText *m_pFt_action;
ProgressBar *m_pStatusbar; ProgressBar *m_pStatusbar;
FixedText *m_pFt_extension_name; FixedText *m_pFt_extension_name;
AutoScrollEdit *m_pMle_info; VclMultiLineEdit *m_pMle_info;
HelpButton *m_pHelp; HelpButton *m_pHelp;
OKButton *m_pOk; OKButton *m_pOk;
CancelButton *m_pCancel; CancelButton *m_pCancel;
}; };
} }
#endif #endif
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.16.1 -->
<interface> <interface>
<!-- interface-requires LibreOffice 1.0 --> <requires lib="gtk+" version="3.0"/>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkDialog" id="UpdateInstallDialog"> <object class="GtkDialog" id="UpdateInstallDialog">
<property name="width_request">500</property>
<property name="height_request">250</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="border_width">6</property> <property name="border_width">6</property>
<property name="title" translatable="yes">Download and Installation</property> <property name="title" translatable="yes">Download and Installation</property>
...@@ -25,7 +23,6 @@ ...@@ -25,7 +23,6 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
</object> </object>
<packing> <packing>
...@@ -42,7 +39,6 @@ ...@@ -42,7 +39,6 @@
<property name="sensitive">False</property> <property name="sensitive">False</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
</object> </object>
<packing> <packing>
...@@ -58,7 +54,6 @@ ...@@ -58,7 +54,6 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
</object> </object>
<packing> <packing>
...@@ -89,6 +84,8 @@ ...@@ -89,6 +84,8 @@
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="halign">start</property> <property name="halign">start</property>
<property name="label" translatable="yes">Downloading extensions...</property> <property name="label" translatable="yes">Downloading extensions...</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">STATUSBAR</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
...@@ -125,6 +122,8 @@ ...@@ -125,6 +122,8 @@
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="halign">start</property> <property name="halign">start</property>
<property name="label" translatable="yes">Result</property> <property name="label" translatable="yes">Result</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">INFO</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
...@@ -133,26 +132,16 @@ ...@@ -133,26 +132,16 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkScrolledWindow" id="scrolledwindow1"> <object class="GtkTextView" id="INFO">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="vexpand">True</property> <property name="vexpand">True</property>
<property name="shadow_type">in</property> <property name="editable">False</property>
<child> <property name="cursor_visible">False</property>
<object class="deploymentgui-AutoScrollEdit" id="INFO">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="editable">False</property>
<property name="cursor_visible">False</property>
<property name="accepts_tab">False</property>
</object>
</child>
</object> </object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">4</property> <property name="position">4</property>
</packing> </packing>
......
...@@ -323,9 +323,6 @@ ...@@ -323,9 +323,6 @@
<glade-widget-class title="Cui Custom MultiLine Edit" name="cuilo-CuiCustomMultilineEdit" <glade-widget-class title="Cui Custom MultiLine Edit" name="cuilo-CuiCustomMultilineEdit"
generic-name="CuiCustomMultiLineEdit" parent="GtkTextView" generic-name="CuiCustomMultiLineEdit" parent="GtkTextView"
icon-name="widget-gtk-textview"/> icon-name="widget-gtk-textview"/>
<glade-widget-class title="AutoScrollEdit" name="deploymentgui-AutoScrollEdit"
generic-name="AutoScrollEdit" parent="GtkTextView"
icon-name="widget-gtk-textview"/>
<glade-widget-class title="LicenseView" name="deploymentgui-LicenseView" <glade-widget-class title="LicenseView" name="deploymentgui-LicenseView"
generic-name="LicenseView" parent="GtkTextView" generic-name="LicenseView" parent="GtkTextView"
icon-name="widget-gtk-textview"/> icon-name="widget-gtk-textview"/>
......
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