General :  K-Meleon Web Browser Forum
General discussion about K-Meleon 
Pages: Previous1234Next
Current Page: 3 of 4
Re: Mozi-Meleon
Posted by: MonkeeSage
Date: April 13, 2003 03:15AM

Re: Separators:

Problem; Separators are counted as buttons in the button count that the rebar width is derived from--though they are only 8 pixels wide.

The result; You have your current button size (minus 8 pixels) too much space at the end of the rebar when using separators.

The fix:

In toolbars\toolbars.cpp, at the top of DoRebar(HWND rebarWnd):

int sep = 0;


In the else {} block, after while (button) {}:

sep++;


Where rbBand is being set up:

int sepSizeDef = LOWORD(dwBtnSize)-8;
rbBand.cxMinChild = (LOWORD(dwBtnSize) * toolbar->iButtonCount)-(sepSizeDef * sep);
//...
rbBand.cxIdeal = (LOWORD(dwBtnSize) * toolbar->iButtonCount)-(sepSizeDef * sep);


And finally, right after if (buttons) {}:

sep = 0;

Pretty simple. Just made a deficit (sepSizeDef) from button size (dwBtnSize) minus separator size (8), then when the rebar size is set from the button count, subtract as many of the deficits as there are separators ( -(sepSizeDef * sep)).

Fixed build is up at http://monkeesage.d2g.com/toolbars.dll


Re: Chevrons: I see the condition if (bChevronEnabled) in the other plugins as well, but I don't see anywhere to enable or disable it in the plugin configuration under K-M, and they are evidentally disabled by default cause they don't show up...possibly they need a definition like &Bookmarks{} under menus.cfg to enable them or something?


Shelumi`El
Jordan

S.D.G

Options: ReplyQuote
Re: Mozi-Meleon
Posted by: jsnj
Date: April 13, 2003 04:30AM

Cool. Toolbars with separators works well now, thanks. When I tried the favorites and hotlist toolbars, all the conditions present for bookmarks in menus.cfg were the same for hotlist and favorites and the chevrons never appeared.

Options: ReplyQuote
Re: Mozi-Meleon
Posted by: asmpgmr
Date: April 13, 2003 02:14PM

These are the prefs (true/false):

kmeleon.plugins.bookmarks.chevron
kmeleon.plugins.favorites.chevron
kmeleon.plugins.hotlist.chevron

Options: ReplyQuote
Re: Mozi-Meleon
Posted by: jsnj
Date: April 13, 2003 05:59PM

Worked for the Hotlist, not Favorites. "Links" appears but not the chevron.

Options: ReplyQuote
Re: Mozi-Meleon
Posted by: jsnj
Date: April 14, 2003 03:21PM

Can the go_button macro be adjusted or completely changed to recognize bookmark keywords written in the url bar instead of always assuming it's a web address?

Options: ReplyQuote
Re: Mozi-Meleon
Posted by: asmpgmr
Date: April 14, 2003 04:29PM

No. Really now, the go button ?!? The go button is ridiculous nonsense as is the go menu item or anything else starting with "go", "start", or "my". Stuff like this should be expunged from software everywhere. Just type or recall an address and press enter.

Options: ReplyQuote
Re: Mozi-Meleon
Posted by: jsnj
Date: April 14, 2003 04:53PM

It's beneficial for those of us who are mouse users. I'm aware you're probably not one of them. The go_button comes in handy when picking from the short url bar list (which is typically much shorter than the bookmarks list) for previously typed keywords. Using the mouse is sometimes easier than typing especially if you don't always feel like having both hands hovering over the keyboard. It's not a big issue but most of these tweaks and improvements are not big issues. I just wondered if the macro was doable. KM is already great as it is.

Options: ReplyQuote
Re: Mozi-Meleon
Posted by: jsnj
Date: April 14, 2003 05:01PM

As for the go menu, the way the traditional standard browser menu is setup and split up is unnecessary IMO, that's why I've done away with it completely.

Options: ReplyQuote
Re: Mozi-Meleon
Posted by: asmpgmr
Date: April 14, 2003 05:55PM

jsnj,

Ok, that's a valid reason for it, I always thought of the go button as a dummies/newbies thing. Maybe you can use the pluginmsg macro function and send "findnick" to the bookmarks or hotlist plugin (favorites doesn't have findnick support). Hey if you know how the quicksearch nicknames are stored with the favorites in M$IE then the support can be added.

Options: ReplyQuote
Re: Mozi-Meleon
Posted by: asmpgmr
Date: April 14, 2003 09:38PM

jsnj,

$url = pluginmsgex( "bookmarks", "FindNick", $nick, STRING );
$url = pluginmsgex( "hotlist", "FindNick", $nick, STRING );

$url will be null if the nickname is not found. You want to parse out the first word of whatever is entered and use that for the nickname search to match the URL bar lookup code I added. The %s handling will take more macro work but should be doable, remember that %s doesn't necessarily have to be at the end.

Options: ReplyQuote
Re: Mozi-Meleon
Posted by: jsnj
Date: April 14, 2003 11:27PM

Cool, that works well within this:

gonick {
id(ID_SELECT_URL);
id(ID_EDIT_COPY);
$theurl = getclipboard();
$nick = pluginmsgex( "bookmarks", "FindNick", $theurl, STRING );
open($nick);
}


I'm trying to find a way for it to automatically do a host search on the text if a nickname is not found i.e. behave the way the ENTER key does. Therefore it would only be necessary to have one go button instead of an additional FindNick button. I looked at the Statements section in the Macro Language page within the manual, but coudn't figure it out.

Options: ReplyQuote
Re: Mozi-Meleon
Posted by: asmpgmr
Date: April 14, 2003 11:35PM

See my previous message.

Options: ReplyQuote
Re: Mozi-Meleon
Posted by: MonkeeSage
Date: April 14, 2003 11:38PM

jsnj:

Try this:

go_button {
$oldclip = getclipboard();
id(ID_SELECT_URL);
id(ID_EDIT_COPY);
$theurl = getclipboard();
$nick = pluginmsgex( "bookmarks", "FindNick", $theurl, STRING );
$nick == "" ? $nick = pluginmsgex( "hotlist", "FindNick", $theurl, STRING ) : 0;
$nick == "" ? open($theurl) : open($nick);
setclipboard($oldclip);
}


Shelumi`El
Jordan

S.D.G

Options: ReplyQuote
Re: Mozi-Meleon
Posted by: Arual the Wyrd
Date: April 14, 2003 11:40PM

I think we need a new forum section for the K-Zilla crowd ;-)

Options: ReplyQuote
Re: Mozi-Meleon
Posted by: asmpgmr
Date: April 14, 2003 11:56PM

MonkeeSage,

You should also parse out the first word and only do a nickname lookup on that.


arual

I think you need to stop posting meaningless crap and get lost since you have nothing useful to contribute.

Options: ReplyQuote
Re: Mozi-Meleon
Posted by: MonkeeSage
Date: April 15, 2003 12:02AM

jsnj:

Try this one for quicksearch support:

go_button {
$theurl1="";
$theurl2="";
$nick1="";
$nick2="";

$oldclip = getclipboard();
id(ID_SELECT_URL);
id(ID_EDIT_COPY);

$theurl = getclipboard();
$len = length($theurl);
$index = index($theurl, " ");
$index == -1 ? $theurl1 = $theurl : $theurl1 = substr($theurl, 0, $index);
$index == -1 ? 0 : $theurl2 = substr($theurl, $index+1, $len);

$nick = pluginmsgex( "bookmarks", "FindNick", $theurl1, STRING );
$nick == "" ? $nick = pluginmsgex( "hotlist", "FindNick", $theurl1, STRING ) : 0;
$nick == "" ? open($theurl1) : 0;

$len = length($nick);
$index = index($nick, "%s");
$index == -1 ? open($nick) : 0;

$nick1 = substr($nick, 0, $index);
$nick2 = substr($nick, $index+2, $len);
open($nick1 . $theurl2 . $nick2);
setclipboard($oldclip);
}


I think I got that right, heh. smiling smiley


Shelumi`El
Jordan

S.D.G

Options: ReplyQuote
Re: Mozi-Meleon
Posted by: asmpgmr
Date: April 15, 2003 12:17AM

MonkeeSage,

It looks like it could attempt more than one open, you should assign the open strings to a variable as you go along and open whatever the variable is set to at the end.

Options: ReplyQuote
Re: Mozi-Meleon
Posted by: jsnj
Date: April 15, 2003 12:22AM

MonkeeSage,

Thanks, it works without flaw on quicksearches. On keywords it also works but a prompt appears with "ttp is not a registered protocol". I don't understand the macro enough to know why that appears. One question I have though is why are the lines: $oldclip = getclipboard(); and setclipboard($oldclip); used when the macro works exactly the same without them? Same goes for the normal go_button macro that's included in macros by default.

Options: ReplyQuote
Re: Mozi-Meleon
Posted by: MonkeeSage
Date: April 15, 2003 01:09AM

asmpgmr:

Yes, you're right, it will do two opens (though you only see the last one) when there is a keyword. I'll fix it.

jsnj:

I think it's because I did way I placed the substr with index+2...try this fixed version:


go_button {
# vars
$theurl1="";
$theurl2="";
$nick1="";
$nick2="";
$isUrl="";
$isNick="";
$isQs="";

# get the url bar text into $theurl and reset the clipboard
$oldclip = getclipboard();
id(ID_SELECT_URL);
id(ID_EDIT_COPY);
$theurl = getclipboard();
setclipboard($oldclip);

# check for spaces in $theurl, if no spaces $theurl1 inherits $theurl
$len = length($theurl);
$index = index($theurl, " ");
$index == -1 ? $theurl1 = $theurl : $theurl1 = substr($theurl, 0, $index);
$index == -1 ? 0 : $theurl2 = substr($theurl, $index+1, $len);

# check for nickname
$nick = pluginmsgex( "bookmarks", "FindNick", $theurl1, STRING );
$nick == "" ? $nick = pluginmsgex( "hotlist", "FindNick", $theurl1, STRING ) : 0;

# if not a nickname, it is a URL
$nick == "" ? $isUrl = "TRUE" : 0;

# otherwise is a nickname, check for quicksearch token
$len = length($nick);
$index = index($nick, "%s");

# if no quicksearch token, open as URL
$index == -1 ? $isNick = "TRUE" : $isQs = "TRUE";

# otherwise is a quicksearch, tokenize $nick and replace
# quicksearch token with $theurl2
$nick1 = substr($nick, 0, $index);
$nick2 = substr($nick, $index+2, $len);

# now do our open stuff
$isUrl == "TRUE" ? open($theurl1) : 0;
$isNick == "TRUE" ? open($nick) : 0;
$isQs == "TRUE" ? open($nick1 . $theurl2 . $nick2) : 0;
}


Shelumi`El
Jordan

S.D.G

Options: ReplyQuote
Re: Mozi-Meleon
Posted by: jsnj
Date: April 15, 2003 02:07AM

Works perfectly. Thanks. Also tested it with quicksearches that have %s in the middle of the address. Thanks for the explanations too.

Options: ReplyQuote
Re: Mozi-Meleon
Posted by: MonkeeSage
Date: April 15, 2003 02:33AM

On the subject of nicks & quicksearches, I just added asmpgmr's code to Plugins.cpp in the NavigateTo() function, this way both nicks and quicksearches can be called from any of the open commands in macros (open, opennew, openbg). smiling smiley

void NavigateTo(const char *url, int windowState, HWND mainWnd)
{
CBrowserFrame *mainFrame;
if (mainWnd)
mainFrame = (CBrowserFrame *)CWnd::FromHandle(mainWnd);
else
mainFrame = theApp.m_pMostRecentBrowserFrame;

if (!mainFrame) {
return;
}

char *p, *q, *r;
char nickUrl[INTERNET_MAX_URL_LENGTH];
char custUrl[INTERNET_MAX_URL_LENGTH];

CString strUrl;
strUrl = url;

// Check for a nickname
*nickUrl = 0;
p = strUrl.GetBuffer(0); // get entered URL
p = SkipWhiteSpace(p); // skip any leading spaces
q = strchr(p, ' '); // look for a space

if (q) // if more than one word
*q = 0; // terminate first word

theApp.plugins.SendMessage("bookmarks", "* FindNick", "FindNick", (long)p, (long)&nickUrl);

if (q) // if more than one word
*q = ' '; // restore space

if (*nickUrl != 0) {
r = strstr(nickUrl, "%s"); // look for %s
if (r) { // if found
*r = 0; // terminate string up to %s
strcpy(custUrl, nickUrl); // copy string before %s
if (q) // if more than one word
strcat(custUrl, q+1); // copy second word
strcat(custUrl, r+2); // copy string after %s
url = custUrl;
}
else
url = nickUrl;
}
else {
theApp.plugins.SendMessage("hotlist", "* FindNick", "FindNick", (long)p, (long)&nickUrl);
if (*nickUrl != 0)
url = nickUrl;
else {
url = strUrl.GetBuffer(0);
}
}

switch(windowState) {
case OPEN_NORMAL:
mainFrame->m_wndBrowserView.OpenURL(url);
break;
case OPEN_NEW:
mainFrame->m_wndBrowserView.OpenURLInNewWindow(NS_ConvertASCIItoUCS2(url).get());
break;
case OPEN_BACKGROUND:
mainFrame->m_wndBrowserView.OpenURLInNewWindow(NS_ConvertASCIItoUCS2(url).get(), true);
break;
}
}


I'll make the date on top left of the site current when the all the builds include this update, it will probably take me a couple hours though, so don't hold your breath.


Shelumi`El
Jordan

S.D.G

Options: ReplyQuote
Re: Mozi-Meleon
Posted by: MonkeeSage
Date: April 15, 2003 02:40AM

FYI, this also means that the whole macro above for the go button will be rendered unnecessary lol, all you need once you have the updated build is the default go_button macro:

go_button {
$oldclip = getclipboard();
id(ID_SELECT_URL);
id(ID_EDIT_COPY);
$theurl = getclipboard();
setclipboard($oldclip);
open($theurl);
}



Shelumi`El
Jordan

S.D.G

Options: ReplyQuote
Re: Mozi-Meleon
Posted by: asmpgmr
Date: April 15, 2003 02:55AM

MonkeeSage,

I don't think that should be put in NavigateTo as that affects ALL plugins which open URLs (bookmarks, favorites, hotlist, history, and macros). It's also duplicate code in two places. I'm pretty sure the feature in Mozilla is only a URL bar lookup facility.

Options: ReplyQuote
Re: Mozi-Meleon
Posted by: MonkeeSage
Date: April 15, 2003 03:04AM

asmpgmr:

This is what I ended up with now:

UnknownContentTypeHandler.h:
-----------------------------------
#include "wininet.h" // for INTERNET_MAX_URL_LENGTH
#include "Utils.h" // for SkipWhiteSpace();


BrowserViewUtils.cpp:
--------------------------------
void CBrowserView::OpenURL(const char* pUrl)
{
char *p, *q, *r;
char nickUrl[INTERNET_MAX_URL_LENGTH];
char custUrl[INTERNET_MAX_URL_LENGTH];

CString strUrl;
strUrl = pUrl;

// Check for a nickname
*nickUrl = 0;
p = strUrl.GetBuffer(0); // get entered URL
p = SkipWhiteSpace(p); // skip any leading spaces
q = strchr(p, ' '); // look for a space

if (q) // if more than one word
*q = 0; // terminate first word

theApp.plugins.SendMessage("bookmarks", "* FindNick", "FindNick", (long)p, (long)&nickUrl);

if (q) // if more than one word
*q = ' '; // restore space

if (*nickUrl != 0) {
r = strstr(nickUrl, "%s"); // look for %s
if (r) { // if found
*r = 0; // terminate string up to %s
strcpy(custUrl, nickUrl); // copy string before %s
if (q) // if more than one word
strcat(custUrl, q+1); // copy second word
strcat(custUrl, r+2); // copy string after %s
pUrl = custUrl;
}
else
pUrl = nickUrl;
}
else {
theApp.plugins.SendMessage("hotlist", "* FindNick", "FindNick", (long)p, (long)&nickUrl);
if (*nickUrl != 0)
pUrl = nickUrl;
else {
pUrl = strUrl.GetBuffer(0);
}
}
OpenURL(NS_ConvertASCIItoUCS2(pUrl).get());
}

// ...

void CBrowserView::OpenURLInNewWindow(const char* pUrl)
{
char *p, *q, *r;
char nickUrl[INTERNET_MAX_URL_LENGTH];
char custUrl[INTERNET_MAX_URL_LENGTH];

CString strUrl;
strUrl = pUrl;

// Check for a nickname
*nickUrl = 0;
p = strUrl.GetBuffer(0); // get entered URL
p = SkipWhiteSpace(p); // skip any leading spaces
q = strchr(p, ' '); // look for a space

if (q) // if more than one word
*q = 0; // terminate first word

theApp.plugins.SendMessage("bookmarks", "* FindNick", "FindNick", (long)p, (long)&nickUrl);

if (q) // if more than one word
*q = ' '; // restore space

if (*nickUrl != 0) {
r = strstr(nickUrl, "%s"); // look for %s
if (r) { // if found
*r = 0; // terminate string up to %s
strcpy(custUrl, nickUrl); // copy string before %s
if (q) // if more than one word
strcat(custUrl, q+1); // copy second word
strcat(custUrl, r+2); // copy string after %s
pUrl = custUrl;
}
else
pUrl = nickUrl;
}
else {
theApp.plugins.SendMessage("hotlist", "* FindNick", "FindNick", (long)p, (long)&nickUrl);
if (*nickUrl != 0)
pUrl = nickUrl;
else {
pUrl = strUrl.GetBuffer(0);
}
}
OpenURLInNewWindow(NS_ConvertASCIItoUCS2(pUrl).get());
}


BrowserView.cpp:
-------------------------
void CBrowserView::OnNewUrlEnteredInUrlBar()
{
nsCOMPtr<nsIWebBrowserFocus> focus(do_GetInterface(mWebBrowser));
if(!focus) return;

focus->Activate();
mpBrowserFrame->m_wndUrlBar.EditChanged(FALSE);

// Get the currently entered URL
CString strUrl;
mpBrowserFrame->m_wndUrlBar.GetEnteredURL(strUrl);

if(IsViewSourceUrl(strUrl))
OpenViewSourceWindow(strUrl.GetBuffer(0));
else
// Navigate to that URL
OpenURL(strUrl.GetBuffer(0));

// Add what was just entered into the UrlBar
mpBrowserFrame->m_wndUrlBar.AddURLToList(strUrl);
}


It has to be defined twice to also work for opening new background windows, but doing it this way makes its globally consistant as far as I can tell, so that anywhere in K-M that you can type in a URL, nicks & quicksearches will also be accessable.


Shelumi`El
Jordan

S.D.G

Options: ReplyQuote
Re: Mozi-Meleon
Posted by: MonkeeSage
Date: April 15, 2003 03:18AM

Actually in BrowserViewUtils.cpp it has to be:

void CBrowserView::OpenURLInNewWindow(const char* pUrl, BOOL bBackground)
{
char *p, *q, *r;
char nickUrl[INTERNET_MAX_URL_LENGTH];
char custUrl[INTERNET_MAX_URL_LENGTH];

CString strUrl;
strUrl = pUrl;

// Check for a nickname
*nickUrl = 0;
p = strUrl.GetBuffer(0); // get entered URL
p = SkipWhiteSpace(p); // skip any leading spaces
q = strchr(p, ' '); // look for a space

if (q) // if more than one word
*q = 0; // terminate first word

theApp.plugins.SendMessage("bookmarks", "* FindNick", "FindNick", (long)p, (long)&nickUrl);

if (q) // if more than one word
*q = ' '; // restore space

if (*nickUrl != 0) {
r = strstr(nickUrl, "%s"); // look for %s
if (r) { // if found
*r = 0; // terminate string up to %s
strcpy(custUrl, nickUrl); // copy string before %s
if (q) // if more than one word
strcat(custUrl, q+1); // copy second word
strcat(custUrl, r+2); // copy string after %s
pUrl = custUrl;
}
else
pUrl = nickUrl;
}
else {
theApp.plugins.SendMessage("hotlist", "* FindNick", "FindNick", (long)p, (long)&nickUrl);
if (*nickUrl != 0)
pUrl = nickUrl;
else {
pUrl = strUrl.GetBuffer(0);
}
}
if (bBackground == TRUE)
OpenURLInNewWindow(NS_ConvertASCIItoUCS2(pUrl).get(), bBackground);
else
OpenURLInNewWindow(NS_ConvertASCIItoUCS2(pUrl).get());
}


And then in BrowserView.h:

void CBrowserView::OpenURLInNewWindow(const char* pUrl, BOOL bBackground=FALSE);


Shelumi`El
Jordan

S.D.G

Options: ReplyQuote
Re: Mozi-Meleon
Posted by: MonkeeSage
Date: April 15, 2003 11:56AM

All the builds are updated, plus the newest macros.dll has a new command fileprompt(), like prompt() except for files instead of text strings. Returns the fully qualified path to the file selected (useful for e.g., calling exec() on the return value).


Shelumi`El
Jordan

S.D.G

Options: ReplyQuote
Re: Mozi-Meleon
Posted by: asmpgmr
Date: April 15, 2003 02:01PM

MonkeeSage,

Moving the code to NavigateTo affects all plugins and moving it to OpenURL and OpenURLInNewWindow affects EVERYTHING, that's not good. Plus it's two copies of the same code. Drastic code changes should not be made for a single UI request. This is the sort of thing that ultimately leads to bloat and other problems.

Here is a more efficient way to address the issue:

Restore the original code so that the nickname lookup is only in OnNewUrlEnteredInUrlBar.

Add a new command to the message map table in BrowserView.cpp:
ON_COMMAND(ID_PROCESS_URL, OnNewUrlEnteredInUrlBar)

In defineMap.cpp:
DEFINEMAP_ADD(ID_PROCESS_URL)

In resource.h:
#define ID_PROCESS_URL 32820


Then:
go_button {
$oldclip = getclipboard();
id(ID_SELECT_URL);
id(ID_EDIT_COPY);
id(ID_PROCESS_URL);
$theurl = getclipboard();
setclipboard($oldclip);
}

Options: ReplyQuote
Re: Mozi-Meleon
Posted by: asmpgmr
Date: April 15, 2003 02:17PM

Actually the macro should simply be:

go_button {
id(ID_PROCESS_URL);
}

Options: ReplyQuote
Re: Mozi-Meleon
Posted by: MonkeeSage
Date: April 16, 2003 12:21AM

asmpgmr:

Moving the code to NavigateTo affects all plugins and moving it to OpenURL and OpenURLInNewWindow affects EVERYTHING, that's not good.

I disagree. I think that's great that it effects everything--that's the effect I was trying to achieve. One little part of K-M should not have exrea features that can't be reached from other parts. In my opinion the Ctrl-O dialog should behave exactly as the URL bar, as should the open commands from plugins, &c.


Plus it's two copies of the same code.

Yeah, but same goes for adding a new command ID.


Also, as a command ID, how do you evaluate URL and return it???

Like, let's say you have Ctrl-Shift-N set to open_new, and open_new is defined like this:

open_new{
$loc = prompt("URL:", "Open New Window", "");
$loc == "" ? 0 : opennew($loc);
}

What if $loc is a nickname or quicksearch? It would have to be evaluated first, otherwise opennew() will complain that it is a malformed URL and fail.

This is why I originally put it in NavigateTo. That works, but then Ctrl-O doesn't work for nicks or quicksearches. Thus, I ultimately moved it into OpenURL and OpenURLInNewWindow so that nicks and quicksearches are available globally, and anywhere you can enter a URL will support nicks and quicksearches.


Shelumi`El
Jordan

S.D.G

Options: ReplyQuote
Re: Mozi-Meleon
Posted by: asmpgmr
Date: April 16, 2003 02:20AM

MonkeeSage,

It's only supposed to be a URL bar feature, there could be unforeseen side effects in altering the actual open functions which are only meant for actual URLs.

Adding the new command ID only adds ~32 bytes whereas duplicate code adds a whole lot more. Also as a command ID, the go button could be done without a macro at all, simply assign ID_PROCESS_URL to the button, that's really the correct implementation for a go button.

Frankly there is nothing here that can't be done without ANY changes considering the macro facility, adding extra code based upon one request, then another, and another is the sort of thing that ultimately leads to bloat and out of control projects (like Mozilla).

Options: ReplyQuote
Pages: Previous1234Next
Current Page: 3 of 4


K-Meleon forum is powered by Phorum.