Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: 280Z28 on December 21, 2005, 08:55:38 pm

Title: Where is my reverse mouse cursor?
Post by: 280Z28 on December 21, 2005, 08:55:38 pm
This concerns Windows builds.

When you hover over the line numbers of an editor, you can click to select a full line. The mouse cursor should point to the right while over this selection margin to indicate the expected action. It doesn't.

There is a line of code at codeblocks/sdk/wxscintilla/src/scintilla/src/Editor.cxx:5215 that sets the mouse cursor to point right. I have used the debugger and verified this line IS getting called at the right time.

The problem seems to lie inthe way wxWidgets handles the call. If you look at wxWidgets-2.6.2/src/msw/cursor.cpp:313, you can see that the right arrow is not defined as a Windows default. Instead, the cursor is supposed to load from the wxWidgets DLL, as specified in the resource file wxWidgets-2.6.2/include/wx/msw/wx.rc:55.

So why did I mention all this? Well, it seems there is a right-cursor that DOES get shown at one point. If you hover your mouse over the far left pixel of the text area in the Build Log or the Code::Blocks message tab (a couple tabs to the left of the build log on mine), the cursor points to the right. Why does it happen here, and how can we make use of that to make it also point to the right when you're hovered over the selection margin of an editor window?
Title: Re: Where is my reverse mouse cursor?
Post by: takeshimiya on December 21, 2005, 10:41:49 pm
This bug along with the one described here (http://sourceforge.net/tracker/index.php?func=detail&aid=1201664&group_id=126998&atid=707419) are the most annoying ones personally. I've met them when I first discovered C::B and I was really worried no other noticed it.

I didn't bothered to fix it because I thought it was a scintilla bug, but it seems not.
Title: Re: Where is my reverse mouse cursor?
Post by: 280Z28 on December 21, 2005, 10:46:05 pm
This bug along with the one described here (http://sourceforge.net/tracker/index.php?func=detail&aid=1201664&group_id=126998&atid=707419) are the most annoying ones personally. I've met them when I first discovered C::B and I was really worried no other noticed it.

I didn't bothered to fix it because I thought it was a scintilla bug, but it seems not.

I can fix that one. I just fixed the one where after you type '}' and it automatically lines up your brace, the next uparrow or downarrow keystroke puts the cursor at the beginning of the line you move to instead of right above or below where the brace is.

Can you figure out what's different between the editor margin and the build log margin?  :?
Title: Re: Where is my reverse mouse cursor?
Post by: 280Z28 on December 22, 2005, 12:08:33 am
To fix the behavior in the breakpoint margin, comment out the following line from sdk/cbeditor.cpp:
Code
m_pControl->SetMarginSensitive(1, 1);

There's only one such line in the file. You can still set, edit, and remove breakpoints and bookmarks by right-clicking the margin.
Title: Re: Where is my reverse mouse cursor?
Post by: grv575 on December 22, 2005, 02:25:15 am
There's only one such line in the file. You can still set, edit, and remove breakpoints and bookmarks by right-clicking the margin.

Isn't being able to set breakpoints easily (1 click) more important than visual feedback when highlighting a line?  I think it's a scintilla shortcoming/bug in any case.
Title: Re: Where is my reverse mouse cursor?
Post by: 280Z28 on December 22, 2005, 02:33:37 am
There's only one such line in the file. You can still set, edit, and remove breakpoints and bookmarks by right-clicking the margin.

Isn't being able to set breakpoints easily (1 click) more important than visual feedback when highlighting a line?  I think it's a scintilla shortcoming/bug in any case.

We're talking about two different things. The line I mentioned doesn't have anything to do with what the cursor looks like. I was responding to Takeshi's mentioned (linked) feature request.
Title: Re: Where is my reverse mouse cursor?
Post by: takeshimiya on December 22, 2005, 03:00:50 am
Yeah, and I can say GREAT! :o

In response to
Isn't being able to set breakpoints easily (1 click) more important than visual feedback when highlighting a line?
I say no, and no, and no again. But it's a matter of taste, so it should be a user-setting (which the default value remains to be discussed).
I can hear ActionsManager somewhere :)
Title: Re: Where is my reverse mouse cursor?
Post by: mandrav on December 22, 2005, 11:52:59 am
About the right-pointing cursor, it's working now. It is included in the standard wxWidgets resources which were not linked in the application. A fixed resource file is committed now.
Title: Re: Where is my reverse mouse cursor?
Post by: takeshimiya on December 22, 2005, 06:30:55 pm
More great! :D

In the left-margin think the defaults should be:
Left-click: Select the line.
Mid-click: Toggles breakpoint
Right-click: Shows the menu "Add breakpoint/Add bookmark".

And make that configurable in the case the users desires to change.
Title: Re: Where is my reverse mouse cursor?
Post by: 280Z28 on December 22, 2005, 07:08:26 pm
About the right-pointing cursor, it's working now. It is included in the standard wxWidgets resources which were not linked in the application. A fixed resource file is committed now.

Haha well dang, I wasn't expecting to wake up to a fix.

Thanks man :)
Title: Re: Where is my reverse mouse cursor?
Post by: takeshimiya on December 22, 2005, 09:03:42 pm
About the right-pointing cursor, it's working now. It is included in the standard wxWidgets resources which were not linked in the application. A fixed resource file is committed now.

Don't close this bug yet. A rather cosmetical, but strange thing: The reverse-cursor in the margin and build-log aren't the same. The one in margin is ugly (and non-native).

The included in wx (rightarr.cur) is ugly and is the one present in the right margin.
The one in the build-log is somehow the native one used in windows.

How the build-log manages to do that?
Title: Re: Where is my reverse mouse cursor?
Post by: 280Z28 on December 22, 2005, 09:18:59 pm
Yikes. Ugly cursor alert! Windows users:

Extract this and place rightarr.cur in wxWidgets-2.6.2\include\wx\msw, then delete CodeBlocks\src\.objs\2.6\src\resources\resources.o, and rebuild Code::Blocks. You don't have to rebuild wxWidgets.

[attachment deleted by admin]
Title: Re: Where is my reverse mouse cursor?
Post by: 280Z28 on December 22, 2005, 09:19:50 pm
About the right-pointing cursor, it's working now. It is included in the standard wxWidgets resources which were not linked in the application. A fixed resource file is committed now.

Don't close this bug yet. A rather cosmetical, but strange thing: The reverse-cursor in the margin and build-log aren't the same. The one in margin is ugly (and non-native).

The included in wx (rightarr.cur) is ugly and is the one present in the right margin.
The one in the build-log is somehow the native one used in windows.

How the build-log manages to do that?

Haha I didn't even see this post before I fixed the cursor and posted it. I took one look at it and was like oooh heck no.  :lol:
Title: Re: Where is my reverse mouse cursor?
Post by: mandrav on December 22, 2005, 09:27:38 pm
Don't close this bug yet. A rather cosmetical, but strange thing: The reverse-cursor in the margin and build-log aren't the same. The one in margin is ugly (and non-native).

I haven't closed it yet, but I will.
The cursor in the text box in the logs is provided by windows (actually by the native windows control used). The cursor in the editor though, is handled by wxScintilla (and therefore by wxWidgets) which, as we all know, is not a standard windows control.
So, if you don't like the cursor's appearence please post a bug report in the wxScintilla's or wxWidget's forums. We 've got enough important work to do here than worry about such subtleties...  :roll: