Re: [Libreoffice-ux-advise] [Libreoffice] [PATCH] Making default tab prefix name configurable in Calc
On 09/02/12 14:53, Albert Thuswaldner wrote: Hi, [...] So I have improved the patch according to Kohei's suggestion above. Now I store the prefix at each key-stroke and check for illegal characters. When an illegal character is entered, the text is reverted back to the last good prefix. (So basically the same as for the separators in the formula options dialog) The patch also fixes the UI glitches. So it all should be well - but it is not! At least I get two annoying bugs: 1) The cursor moves In front of the text when the Prefix is reverted. I guessed maybe the last backspace moves the cursor but just setting the text doesn't, however using the arrow keys to say insert a '/' in the middle of a prefix and the cursor goes gets repositioned at the start of the text, no idea why that happens, the answer most certainly lies somewhere in vcl/source/control/edit.cxx core/vcl/inc/vcl/edit.hxx 2) When trying to delete text in the edit box, the last character sticks (can't be deleted). well that would seem to be because your code thinks a blank prefix is illegal, I believe changing -if ( !ScDocument::ValidTabName( aSheetPrefix ) ) +if ( !aSheetPrefix.isEmpty() !ScDocument::ValidTabName( aSheetPrefix ) ) { // Revert to last good Prefix pEdit-SetText( maOldPrefixValue ); } will fix that To finish this feature I also would like to add some type of cue. It would be great if there would be some kind of standard to follow here (is there?). Below I just list the different options (including possible pros/cons) that I can think of at the moment: [...] isn't the problem with such visual cues that the illegal character is already gone ( replaced by the previous selection ) by the time you flag it so it might be even more confusing ? Or.. do you see some other type of workflow when using that. Maybe a bell is isn't such a bad idea ( although I agree annoying ) Noel ___ Libreoffice-ux-advise mailing list Libreoffice-ux-advise@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-ux-advise
Re: [Libreoffice-ux-advise] [Libreoffice] [PATCH] Making default tab prefix name configurable in Calc
On 09/02/12 14:53, Albert Thuswaldner wrote: If it was up to me I would go for the visual bell. Any thoughts on this? actually thinking about it some more I don't find it unnatural to have the whole ( reverted ) prefix selected after entering an illegal character ( I think this is a technique used elsewhere anyway ) In addition to providing a cue that you have typed something bad this approach has the added advantage of solving the cursor problem for you too ;-) e.g. // Revert to last good Prefix Selection aSel( 0, maOldPrefixValue.getLength() ); pEdit-SetText( maOldPrefixValue, aSel ); Not sure what others think about above but if I hear no real negative reaction then I'd be inclined to push this p.s. of course you can use the 'Selection' Selection aSel( maOldPrefixValue.getLength(), maOldPrefixValue.getLength() ) to trick SetText to display the cursor at the end. This is a bit hacky, the alternative is you will probably need to modify the cursor position directly, that is, unless there is some existing public method on Edit ( which there might be but I didn't see in the myriad of 'Edit' methods ) Thanks for reading my ramblings.;) /Albert thanks for taking the time with this nice addition Noel ___ Libreoffice-ux-advise mailing list Libreoffice-ux-advise@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-ux-advise
Re: [Libreoffice-ux-advise] [Libreoffice] [PATCH] Making default tab prefix name configurable in Calc
On Mon, Feb 13, 2012 at 12:23, Noel Power nopo...@suse.com wrote: On 09/02/12 14:53, Albert Thuswaldner wrote: 2) When trying to delete text in the edit box, the last character sticks (can't be deleted). well that would seem to be because your code thinks a blank prefix is illegal, I believe changing - if ( !ScDocument::ValidTabName( aSheetPrefix ) ) + if ( !aSheetPrefix.isEmpty() !ScDocument::ValidTabName( aSheetPrefix ) ) { // Revert to last good Prefix pEdit-SetText( maOldPrefixValue ); } will fix that Agggh, your right :) On Mon, Feb 13, 2012 at 13:11, Noel Power nopo...@suse.com wrote: On 09/02/12 14:53, Albert Thuswaldner wrote: If it was up to me I would go for the visual bell. Any thoughts on this? actually thinking about it some more I don't find it unnatural to have the whole ( reverted ) prefix selected after entering an illegal character ( I think this is a technique used elsewhere anyway ) In addition to providing a cue that you have typed something bad this approach has the added advantage of solving the cursor problem for you too ;-) e.g. // Revert to last good Prefix Selection aSel( 0, maOldPrefixValue.getLength() ); pEdit-SetText( maOldPrefixValue, aSel ); Not sure what others think about above but if I hear no real negative reaction then I'd be inclined to push this p.s. of course you can use the 'Selection' Selection aSel( maOldPrefixValue.getLength(), maOldPrefixValue.getLength() ) to trick SetText to display the cursor at the end. This is a bit hacky, the alternative is you will probably need to modify the cursor position directly, that is, unless there is some existing public method on Edit ( which there might be but I didn't see in the myriad of 'Edit' methods ) Yes I vote for pushing this as you suggested. It is a cheap solution for now, and done elsewhere in the code, so at least we are consistent then. Saw the ideas from Markus and Stefan regarding the range name dialog: https://wiki.documentfoundation.org/Design/Whiteboard/Calc_Range_Names A mode-less window (i.e balloon) would be an option for a future improvement. But I guess we leave that for now until we have a consensus on going down that route. Noel: can you push the patch with your changes or do you want me to tweek it? /Albert ___ Libreoffice-ux-advise mailing list Libreoffice-ux-advise@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-ux-advise
Re: [Libreoffice-ux-advise] [Libreoffice] [PATCH] Making default tab prefix name configurable in Calc
Hi, Given that, I still think it's better (and easier) to check for every key-press, but instead of launching an error dialog for an illegal name, just put the old legal name back into the text box and sound an beep or something. That's less intrusive than a big dialog being thrown right in your face. I do exactly that for the argument separator value inputs in the Formula option page. So I have improved the patch according to Kohei's suggestion above. Now I store the prefix at each key-stroke and check for illegal characters. When an illegal character is entered, the text is reverted back to the last good prefix. (So basically the same as for the separators in the formula options dialog) The patch also fixes the UI glitches. So it all should be well - but it is not! At least I get two annoying bugs: 1) The cursor moves In front of the text when the Prefix is reverted. 2) When trying to delete text in the edit box, the last character sticks (can't be deleted). Does someone have a clue whats going on? To finish this feature I also would like to add some type of cue. It would be great if there would be some kind of standard to follow here (is there?). Below I just list the different options (including possible pros/cons) that I can think of at the moment: 1) Error dialog + Grabs attention + Space to provide a meaningful error message. - too in your face 2) FixedLine message + Not in-your-face. - Takes up space - Only space for short error message 3) System bell + Grabs attention - Utterly annoying IMO 4) Visual bell (tinted red flashing of edit field) + Subtile and effective way of feedback. - ? 5.) Icon (warning sign or exclamation mark) + Can be made click-able to give additional information. - Takes up space. 6.) Balloon message + ? - ? If it was up to me I would go for the visual bell. Any thoughts on this? Thanks for reading my ramblings. ;) /Albert From c4e78f3a3c59c76a50639d990803f0edf7f1c4b4 Mon Sep 17 00:00:00 2001 From: Albert Thuswaldner albert.thuswald...@gmail.com Date: Thu, 9 Feb 2012 15:26:27 +0100 Subject: [PATCH] Improvment of Custom Sheet Prefix Option --- sc/source/ui/inc/tpdefaults.hxx|7 - sc/source/ui/optdlg/tpdefaults.cxx | 45 +++ sc/source/ui/src/optdlg.src|6 ++-- 3 files changed, 43 insertions(+), 15 deletions(-) diff --git a/sc/source/ui/inc/tpdefaults.hxx b/sc/source/ui/inc/tpdefaults.hxx index 606d174..7369988 100644 --- a/sc/source/ui/inc/tpdefaults.hxx +++ b/sc/source/ui/inc/tpdefaults.hxx @@ -53,10 +53,12 @@ private: virtual ~ScTpDefaultsOptions(); void CheckNumSheets(); -void CheckPrefix(); +void CheckPrefix(Edit* pEdit); +void OnFocusPrefixInput(Edit* pEdit); DECL_LINK( NumModifiedHdl, NumericField* ); DECL_LINK( PrefixModifiedHdl, Edit* ); +DECL_LINK( PrefixEditOnFocusHdl, Edit* ); private: FixedLine aFLInitSpreadSheet; @@ -65,6 +67,9 @@ private: FixedText aFtSheetPrefix; Edit aEdSheetPrefix; +// Stores old Sheet Prefix +::rtl::OUString maOldPrefixValue; + ::boost::shared_ptrScDocOptions mpOldOptions; ::boost::shared_ptrScDocOptions mpNewOptions; }; diff --git a/sc/source/ui/optdlg/tpdefaults.cxx b/sc/source/ui/optdlg/tpdefaults.cxx index 8c97c83..ec29550 100644 --- a/sc/source/ui/optdlg/tpdefaults.cxx +++ b/sc/source/ui/optdlg/tpdefaults.cxx @@ -29,8 +29,6 @@ #undef SC_DLLIMPLEMENTATION -#include vcl/msgbox.hxx - #include tpdefaults.hxx #include optdlg.hrc #include scresid.hxx @@ -49,9 +47,9 @@ ScTpDefaultsOptions::ScTpDefaultsOptions(Window *pParent, const SfxItemSet rCor SfxTabPage(pParent, ScResId(RID_SCPAGE_DEFAULTS), rCoreAttrs), aFLInitSpreadSheet ( this, ScResId( FL_INIT_SPREADSHEET ) ), aFtNSheets ( this, ScResId( FT_NSHEETS ) ), -aEdNSheets ( this, ScResId( ED_NSHEETS ) ), -aFtSheetPrefix ( this, ScResId( FT_SHEETPREFIX ) ), -aEdSheetPrefix ( this, ScResId( ED_SHEETPREFIX ) ) +aEdNSheets ( this, ScResId( ED_NSHEETS ) ), +aFtSheetPrefix ( this, ScResId( FT_SHEETPREFIX ) ), +aEdSheetPrefix ( this, ScResId( ED_SHEETPREFIX ) ) { FreeResource(); @@ -70,9 +68,10 @@ ScTpDefaultsOptions::ScTpDefaultsOptions(Window *pParent, const SfxItemSet rCor Point aNewPoint = aEdNSheets.GetPosPixel(); aNewPoint.X() += ( nTxtW - nCtrlW ); aEdNSheets.SetPosPixel( aNewPoint ); -} + } aEdNSheets.SetModifyHdl( LINK(this, ScTpDefaultsOptions, NumModifiedHdl) ); aEdSheetPrefix.SetModifyHdl( LINK(this, ScTpDefaultsOptions, PrefixModifiedHdl) ); +aEdSheetPrefix.SetGetFocusHdl( LINK(this, ScTpDefaultsOptions, PrefixEditOnFocusHdl) ); } ScTpDefaultsOptions::~ScTpDefaultsOptions() @@ -121,14 +120,31 @@ void ScTpDefaultsOptions::CheckNumSheets() aEdNSheets.SetValue(INIT_SHEETS_MIN); } -void ScTpDefaultsOptions::CheckPrefix() +void
Re: [Libreoffice-ux-advise] [Libreoffice] [PATCH] Making default tab prefix name configurable in Calc
Hi Albert, At least I get two annoying bugs: 1) The cursor moves In front of the text when the Prefix is reverted. 2) When trying to delete text in the edit box, the last character sticks (can't be deleted). Does someone have a clue whats going on? Hm, no (not a coder I am). But can you check the characters being typed before displaying them and then just ignore them if they're illegal? (Or would that create a lag?) 2) FixedLine message + Not in-your-face. - Takes up space - Only space for short error message This should be the way to go. Please have a look at the stuff that Markus did for 3.5: * core/sc/source/ui/namedlg * core/sc/source/ui/src/name[def]dlg.src (The feature can be found under Insert Names Manage) It currently allows only one-liners, expanding that would be highly welcome, I think. Nevertheless, short error messages are definitely a plus (just not if they're forced to be short). Also have a look at the discussions about the feature (and see why Markus and Christoph didn't like using the system bell -- sorry you'll have to search for this information): http://lists.freedesktop.org/archives/libreoffice-ux-advise/2011-October/000395.html The Whiteboard for the feature is here: https://wiki.documentfoundation.org/Design/Whiteboard/Calc_Range_Names Astron. ___ Libreoffice-ux-advise mailing list Libreoffice-ux-advise@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-ux-advise