Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: White-Tiger on July 11, 2010, 05:28:35 pm

Title: Selection Length
Post by: White-Tiger on July 11, 2010, 05:28:35 pm
Hello,

I'm using Code::Blocks a while ago and there is something that really pissed me of.
I miss a "Selection Length" within the status bar to see how many bytes/chars i have selected. Currently i have to count them by myself or i have to open Notepad (Notepad2/Notepad++ etc.)

Is there a way to integrate it into Code::Blocks? Sry when it is "easy" to activate/enable but i didn't find anything about that.
And why isn't it there already? I mean it is very helpful and even little editors like Notepad2 have it.

Kind regards
White-Tiger
Title: Re: Selection Length
Post by: Jenna on July 11, 2010, 05:44:33 pm
Is there a way to integrate it into Code::Blocks?
I think so.

And why isn't it there already?
As far as I know, nobody ever asked for it.
Title: Re: Selection Length
Post by: White-Tiger on November 09, 2010, 03:37:13 pm
So... now finally I did it by myself :P

Before: (http://www5.pic-upload.de/09.11.10/6csrf5773bhl.jpg)
After:   (http://www5.pic-upload.de/09.11.10/9sg3gdz8tu3.jpg)

For comparison
Notepad2:   (http://www5.pic-upload.de/09.11.10/b1nzf7aq48.jpg)
Notepad++: (http://www5.pic-upload.de/09.11.10/iwrqmwdcm5pg.jpg)

I've chosen the Notepad++ layout, just because I think many already know it, and it's also more handy as Code::Blocks current default. You have less to read, so you spend less time to take a look ;)
Also I've removed some spacings, i don't like it when it isn't equal on both ends :P (I know, it isn't yet either, but it's better ;))

Diff
Code
Index: src/src/main.cpp
===================================================================
--- src/src/main.cpp (revision 6843)
+++ src/src/main.cpp (working copy)
@@ -1699,12 +1699,12 @@
 
     width[num++] = -1; // main field
 //    width[num++] = 128; // progress bar
-    dc.GetTextExtent(_(" WINDOWS-1252 "),           &width[num++], &h);
-    dc.GetTextExtent(_(" Line 12345, Column 123 "), &width[num++], &h);
-    dc.GetTextExtent(_(" Overwrite "),              &width[num++], &h);
-    dc.GetTextExtent(_(" Modified "),               &width[num++], &h);
-    dc.GetTextExtent(_(" Read/Write....."),         &width[num++], &h);
-    dc.GetTextExtent(_(" name_of_profile "),        &width[num++], &h);
+    dc.GetTextExtent(_("WINDOWS-1252"),           &width[num++], &h);
+    dc.GetTextExtent(_("Ln : 12345   Col : 1234   Sel : 12345"), &width[num++], &h);
+    dc.GetTextExtent(_("Overwrite"),              &width[num++], &h);
+    dc.GetTextExtent(_("Modified"),               &width[num++], &h);
+    dc.GetTextExtent(_("Read/Write....."),         &width[num++], &h);
+    dc.GetTextExtent(_("name_of_profile"),        &width[num++], &h);
 
     wxStatusBar* sb = CreateStatusBar(num);
     if (sb)
@@ -1736,8 +1736,9 @@
     {
         int panel = 0;
         int pos = ed->GetControl()->GetCurrentPos();
+        long a, b;ed->GetControl()->GetSelection(&a, &b);
         wxString msg;
-        msg.Printf(_("Line %d, Column %d"), ed->GetControl()->GetCurrentLine() + 1, ed->GetControl()->GetColumn(pos) + 1);
+        msg.Printf(_("Ln : %d   Col : %d   Sel : %ld"), ed->GetControl()->GetCurrentLine() + 1, ed->GetControl()->GetColumn(pos) + 1, b-a);
         SetStatusText(ed->GetFilename(), panel++);
         SetStatusText(ed->GetEncodingName(), panel++);
         SetStatusText(msg, panel++);