General :  K-Meleon Web Browser Forum
General discussion about K-Meleon 
Pages: Previous123
Current Page: 3 of 3
Re: Problem to see videos / macro flash button
Posted by: rodocop
Date: March 12, 2017 10:47PM

Quote
siria
(Having fun with all being here at the same time grinning smiley)

Me too!

Options: ReplyQuote
Re: Problem to see videos / macro flash button
Posted by: siria
Date: March 12, 2017 10:53PM

But it's exactly the definition of Hot and Cold - otherwise how would you define for what Hot is to be used, if not for the checked state?

IMO some alternative scenario would get a LOT more complicated as just this little old/new syntax change.

Options: ReplyQuote
Re: Problem to see videos / macro flash button
Posted by: rodocop
Date: March 12, 2017 11:00PM

Quote
siria
But it's exactly the definition of Hot and Cold - otherwise how would you define for what Hot is to be used, if not for the checked state?

Nope.
COLD - is working icon untouched

HOT - is working icon with mouseover! (and nothing more). Usually HOT image is more bright and colourful (so to say 'lightened') to visually confirm you select right button.

DEAD - is disabled icon (which command is unavailable or non-sense with current context). Usually greyed.



Edited 2 time(s). Last edit at 03/12/2017 11:03PM by rodocop.

Options: ReplyQuote
Re: Problem to see videos / macro flash button
Posted by: rodocop
Date: March 12, 2017 11:06PM

And 'image for checked - image for unchecked' [states] - is completely different paradigm.

Well, we can now handle this using 'setbuttonimg' and conditional routine like one given by JohnHell, but it's slightly cumbersome



Edited 1 time(s). Last edit at 03/12/2017 11:06PM by rodocop.

Options: ReplyQuote
Re: Problem to see videos / macro flash button
Posted by: siria
Date: March 12, 2017 11:07PM

(... and even across half the globe! grinning smiley)

Why do you not want to see different icons for pressed states? It makes a lot of sense to me. And guess most people will prefer different pics too, but that would be become a lot more complicated if always 2 separate commands have to be fired, at each and every toggle.

Options: ReplyQuote
Re: Problem to see videos / macro flash button
Posted by: rodocop
Date: March 12, 2017 11:21PM

Well,
we don't know user PC setup and personal abilities, so 2 changes will reflect the toggle more reliably.

For example, single check toggle could be not good for some skins/Windows themes where it isn't visually clear enough. (We have numerous reports around this).

But for some other people color change could be indistinguishable (Ex.: colorblind people).

Options: ReplyQuote
Re: Problem to see videos / macro flash button
Posted by: siria
Date: March 12, 2017 11:34PM

Quote
rodocop
we don't know user PC setup and personal abilities, so 2 changes will reflect the toggle more reliably.

For example, single check toggle could be not good for some skins/Windows themes where it isn't visually clear enough. (We have numerous reports around this).

But for some other people color change could be indistinguishable (Ex.: colorblind people).

Great, so we agree after all: changing background AND icon at the same time is most reliable - as has always been smiling smiley
Therefore no need to use 2 separate commands, which would make this only harder.

But perhaps the wiki could use a better description, to reduce misunderstandings... Instead of:
"allows the button to appear checked depending on value" a wording more similar to the other command above:
"Make the button appear pressed or not, now, depending on value (false or true)"
And also, in the wiki it's not obvious that a variable ($RETURN) isn't needed at all, just optional for convenience and verifying. And an example might help too, perhaps simply from Dorians native proxy.kmm:
checkbutton("&Privacy Bar", "macros(Proxy_Toggle)", getpref(INT,$_Proxy_Type) == 0 ? true : false);



Edited 2 time(s). Last edit at 03/12/2017 11:41PM by siria.

Options: ReplyQuote
Re: Problem to see videos / macro flash button
Posted by: JamesD
Date: March 13, 2017 12:04AM

Hi everybody.

I am glad we all here again discussing things. I really liked my old way better, but I wanted to see if I could do something useful using the new commands.

I am really glad to have confirmed the order for vertical buttons.

COLD
HOT
DEAD

I deleted some old stuff in December and that included an e-mail from Dorian about that. I no longer trust my memory.

I was worried that I had put some wrong info into the documentation.

I have made so many changes to the fa2_flag.kmm macro that I think that I had better post it again. I don't use the return code from checkbutton. I use the value from the pref adjusted to 0 for 0 or 1 for 2.



fa2_flag.kmm

#  K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage2)
#
# ---------- fa2_flag.kmm
# ---------- Allow user to set the status of "plugin.state.flash" between always and never.
# ---------- The "ask before" option is not addressed here 
#
# Dependencies        : main.kmm
# Reference           : "http://kmeleonbrowser.org/forum/read.php?1,140996";
# Resources           :  flashB.png
# Preferences         : "plugin.state.flash"
# Version             : 2.5 2017_03_12 
# Author              : JamesD
# -----------------------------------------------------------------------------------------------

_fa2_flag_RunCode {
 $_fa2_flag_TTip = "Flip Flash activate between\n  ON (gold) / Off (red)";
 addtoolbar("fa2_flag") ;
 addbutton("fa2_flag", "macros(_fa2_flag_Toggle)", "fa2_flag", $_fa2_flag_TTip);
 #setcmdicon( "macros(_fa2_flag_Toggle)", "check.png" );
 setcmdicon( "macros(_fa2_flag_Toggle)", "flashB.png[1,16,16]", "flashB.png[2,16,16]" );
 macros("_fa2_flag_Button_Sync");
 }

_fa2_flag_Button_Sync { 
 ## ---  SYNC BUTTON TO PREF   --- ##
 $_F2AF_Current = getpref( INT, "plugin.state.flash");
 $_F2AF_Current== 0 ? $__v = 0 : $__v = 1 ; 
 $_F2AF_Return = checkbutton( "fa2_flag", "macros(_fa2_flag_Toggle)", $__v ) ;
}


_fa2_flag_Toggle {
togglepref( INT, "plugin.state.flash", 0,2);
macros("_fa2_flag_Button_Sync");
if ($_F2AF_Current == 2 ) {
    statusbar( "Flash activate is ALWAYS. " .$__v );
    #statusbar( "Flash activate is ALWAYS." );
	} else {
    statusbar( "Flash activate is NEVER. " .$__v );
    #statusbar( "Flash activate is NEVER." );
	}
}

#------------------------------------------------------------------
$OnSetup=$OnSetup."_fa2_flag_RunCode;";
$macroModules=$macroModules."fa2_flag;";


Options: ReplyQuote
Re: Problem to see videos / macro flash button
Posted by: siria
Date: March 13, 2017 12:25AM

If you don't use the Return-var, it would better be omitted completely, to reduce confusion. It's the same syntax as with injectJS, a return-var is optional and only coded if really needed.

the addbutton line calls a menu which the macro doesn't create anywhere...

the setcmdicon line sets gold as cold (pic1=middle) and red as hot (2=rightside)

the sync-macro defines that plugin.state.flash=0 => not pressed => Cold
That means, if flash is "never", the icon shall be cold/gold...

Options: ReplyQuote
Re: Problem to see videos / macro flash button
Posted by: JamesD
Date: March 13, 2017 11:26AM

Quote
siria
If you don't use the Return-var, it would better be omitted completely, to reduce confusion. It's the same syntax as with injectJS, a return-var is optional and only coded if really needed.

the addbutton line calls a menu which the macro doesn't create anywhere...

the setcmdicon line sets gold as cold (pic1=middle) and red as hot (2=rightside)

the sync-macro defines that plugin.state.flash=0 => not pressed => Cold
That means, if flash is "never", the icon shall be cold/gold...

OK, I can drop the return code, but the menu item must be there or an error occurs in Error Console.

Options: ReplyQuote
Re: Problem to see videos / macro flash button
Posted by: JamesD
Date: March 13, 2017 06:37PM

Hello again siria, Johnhell, Rodocop.

I think this version is finally correct. I have used this page to test.

http://www.adobe.com/software/flash/about/

At least I now know that I can do this in the new style code.

Siria, I guess you can't test unless you get you 'other' machine going. You are most helpful at pointing out the things I often overlook when coding. I sometimes cannot see the forest because all the trees are in the way.

JohnHell, I am going to test this code on KM 75.0 right after this post. I think it should work. My memory is bad, but I think the problem that I had with 75 was the very tight sweet spot for the cursor when clicking on the button. I will check. EDIT:: Seems to work fine in 75.

Rodocop, I hope this will run in your system. Please let me know either way.


I did find that I was too much focused on the value for $_F2AF_Current in toggle when I needed to change the one in sync. Once I figured that out things went much better. Looks like the docs are OK.


fa2_flag.kmm

#  K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage2)
#
# ---------- fa2_flag.kmm
# ---------- Allow user to set the status of "plugin.state.flash" between always and never.
# ---------- The "ask before" option is not addressed here 
#
# Dependencies        : main.kmm
# Reference           : "http://kmeleonbrowser.org/forum/read.php?1,140996";
# Resources           :  flashB.png
# Preferences         : "plugin.state.flash"
# Version             : 3.0 2017_03_13 
# Author              : JamesD
# -----------------------------------------------------------------------------------------------

_fa2_flag_RunCode {
 $_fa2_flag_TTip = "Flip Flash activate between\n  ALWAYS ON (gold) / NEVER ON (red)";
 addtoolbar("fa2_flag") ;
 addbutton("fa2_flag", "macros(_fa2_flag_Toggle)", "fa2_flag", $_fa2_flag_TTip);
 setcmdicon( "macros(_fa2_flag_Toggle)", "flashB.png[1,16,16]", "flashB.png[2,16,16]" );
 macros("_fa2_flag_Button_Sync");
 }

_fa2_flag_Button_Sync { 
 ## ---  SYNC BUTTON TO PREF   --- ##
 $_F2AF_Current = getpref( INT, "plugin.state.flash");
 $_F2AF_Current == 2 ? $__v = 0 : $__v = 1 ; 
 checkbutton( "fa2_flag", "macros(_fa2_flag_Toggle)", $__v ) ;
}


_fa2_flag_Toggle {
togglepref( INT, "plugin.state.flash", 0,2);
macros("_fa2_flag_Button_Sync");
if ($_F2AF_Current == 2 ) {
    statusbar( "Flash activate is ALWAYS ON. ");
    } else {
    statusbar( "Flash activate is NEVER ON. " );
    }
}

#------------------------------------------------------------------
$OnSetup=$OnSetup."_fa2_flag_RunCode;";
$macroModules=$macroModules."fa2_flag;";



Edited 1 time(s). Last edit at 03/13/2017 07:21PM by JamesD.

Options: ReplyQuote
Re: Problem to see videos / macro flash button
Posted by: JohnHell
Date: March 13, 2017 07:26PM

Quote
JamesD
JohnHell, I am going to test this code on KM 75.0 right after this post. I think it should work. My memory is bad, but I think the problem that I had with 75 was the very tight sweet spot for the cursor when clicking on the button. I will check. EDIT:: Seems to work fine in 75.

Now works 🖒

The problem with 75.0 was that when using setbuttonimg the image didn't change as it should.

With checkbutton there isn't such issue.

Options: ReplyQuote
Re: Problem to see videos / macro flash button
Posted by: JamesD
Date: March 13, 2017 08:09PM

Thanks JohnHell

I will make this available as a 7z download.

https://www.dropbox.com/s/sy4npko1du6a0p0/Flash%20Activate%20Plugin_fa2.7z?dl=0

Options: ReplyQuote
Re: Problem to see videos / macro flash button
Posted by: JohnHell
Date: March 14, 2017 05:28PM

Icons at 32x32 and horizontal and vertical and vertical reversed.

http://www.mediafire.com/file/ns94wbqaddpaas4/flashB_2017-03-13.zip

Options: ReplyQuote
Pages: Previous123
Current Page: 3 of 3


K-Meleon forum is powered by Phorum.