Re: [patch] panel resizing
Mark Pustjens <[email protected]>
| Newsgroups | gmane.network.centericq |
|---|---|
| Message-ID | <[email protected]> |
Hi all,
i modified Stephen's patch so that panels now have a minimum/maximum size.
--
"That's why it's always worth having a few philosophers around the place.
One minute it's all Is Truth Beauty and Is Beauty Truth, and Does A Falling
Tree in the Forest Make A Sound if There's No one There to Hear It, and
then just when you think they're going to start dribbling one of 'em says,
Incidentally, putting a thirty-foot parabolic reflector on a high place to
shoot the rays of the sun at an enemy's ships would be a very interesting
demonstration of optical principles."
-- The many and varied advantages of philosophy
(Terry Pratchett, Small Gods)
On Tue, 25 Jul 2006, Stephen wrote:
> greeting:
>
> "cicq-panel_sizing-dyn0.patch" is the latest.
> - changed all the hist to log
> - allowed redrawing of screen not erasing the log
> (though it is now a keystroke behind)
> - chat window resizing (resize ... esc esc enter )
> chat window needs to be redrawn
>
> add to keybindings:
> bind contact [ left_panel_move_left
> bind contact ] left_panel_move_right
> bind contact { log_panel_move_up
> bind contact } log_panel_move_down
> bind editor <F4> chat_panel_move_up
> bind editor <F5> chat_panel_move_down
>
> The last set was leftpanel-resizing, sorry for the
> confusion.
>
> --- Tiger!P <[email protected]> wrote:
>
>> On Sun, Jul 23, 2006 at 06:37:18PM -0700, Stephen
>> wrote:
>>> Alright, I have gotten it to work, write history,
>> etc,
>>> but you will have to manually hit ^l or some other
>>> key. The ^l is apparently in kkconsui and goes
>> through
>>> a redraw of some-sort somewhere unseen to me right
>>> now.
>>>
>>> Attached is the new patch, with a new addition
>>
>> Is this a newer patch than the dyn3.patch?
>>
>> Then I'll replace that patch with this one on
>> http://centericq.de
>>
>> Tiger!P
>> _______________________________________________
>> Cicq mailing list
>> Cicq-xGejAJT2w6wWP6gT/[email protected]
>> http://mailman.linuxpl.org/mailman/listinfo/cicq
>> Questions? Check the FAQ first:
>> http://centericq.de/faq/
>>
>
>
> "If you're quiet and tranquil you can become the ruler of the world."
> - Lao Tzu, the Tao Te Ching
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
> _______________________________________________
> Cicq mailing list
> Cicq-xGejAJT2w6wWP6gT/[email protected]
> http://mailman.linuxpl.org/mailman/listinfo/cicq
> Questions? Check the FAQ first: http://centericq.de/faq/
>
_______________________________________________
Cicq mailing list
Cicq-xGejAJT2w6wWP6gT/[email protected]
http://mailman.linuxpl.org/mailman/listinfo/cicq
Questions? Check the FAQ first: http://centericq.de/faq/
centericq-20060722-panel-sizing.patch
(text/plain, 10.9 KB)
--- centericq-22-07/src/icqconf.cc 2006-07-22 17:34:52.000000000 +0200
+++ centericq-22-07-resizeable/src/icqconf.cc 2006-07-24 18:26:36.000000000 +0200
@@ -240,6 +240,10 @@
of << "bind contact\t/\tquickfind" << endl << endl;
of << "bind contact\t\\cn\tnext_chat" << endl;
of << "bind contact\t\\cb\tprev_chat" << endl;
+ of << "bind contact\t[\tleft_panel_move_left" << endl;
+ of << "bind contact\t]\tleft_panel_move_right" << endl;
+ of << "bind contact\t{\tlog_panel_move_up" << endl;
+ of << "bind contact\t}\tlog_panel_move_down" << endl;
of << "bind history\t/\tsearch" << endl;
of << "bind history\ts\tsearch" << endl;
of << "bind history\tn\tsearch_again" << endl;
@@ -254,6 +258,8 @@
of << "bind editor\t\\a?\tinfo" << endl;
of << "bind editor\t<F2>\tshow_urls" << endl;
of << "bind editor\t<F9>\tfullscreen" << endl << endl;
+ of << "bind editor\t<F4>\tchat_panel_move_up" << endl;
+ of << "bind editor\t<F5>\tchat_panel_move_down" << endl;
of << "bind info\t<F2>\tshow_urls" << endl;
of << "bind info\t<F6>\tuser_external_action" << endl;
@@ -369,8 +375,14 @@
if(param == "show_urls") k.action = key_show_urls; else
if(param == "rss_check") k.action = key_rss_check; else
if(param == "multiple_recipients") k.action = key_multiple_recipients; else
- if(param == "user_external_action") k.action = key_user_external_action;
- else continue;
+ if(param == "user_external_action") k.action = key_user_external_action; else
+ if(param == "left_panel_move_left") k.action = key_left_panel_move_left; else
+ if(param == "left_panel_move_right") k.action = key_left_panel_move_right; else
+ if(param == "log_panel_move_up") k.action = key_log_panel_move_up; else
+ if(param == "log_panel_move_down") k.action = key_log_panel_move_down; else
+ if(param == "chat_panel_move_up") k.action = key_chat_panel_move_up; else
+ if(param == "chat_panel_move_down") k.action = key_chat_panel_move_down; else
+ continue;
keys.push_back(k);
}
@@ -464,6 +476,9 @@
if(param == "logonline") logonline = true; else
if(param == "fromcharset") fromcharset = buf; else
if(param == "tocharset") tocharset = buf; else
+ if(param == "left_panel_width") leftpanelwidth = atol(buf.c_str()); else
+ if(param == "log_panel_height") logpanelheight = atol(buf.c_str()); else
+ if(param == "chat_panel_height") chatpanelheight = atol(buf.c_str()); else
if(param == "ptp") {
ptpmin = atoi(getword(buf, "-").c_str());
ptpmax = atoi(buf.c_str());
@@ -578,6 +593,10 @@
if(getmakelog()) f << "log" << endl;
if(getproxyconnect()) f << "proxy_connect" << endl;
if(getproxyssl()) f << "proxy_ssl" << endl;
+
+ if(getleftpanelwidth()) f << "left_panel_width\t" << getleftpanelwidth() << endl;
+ if(getlogpanelheight()) f << "log_panel_height\t" << getlogpanelheight() << endl;
+ if(getchatpanelheight()) f << "chat_panel_height\t" << getchatpanelheight() << endl;
vector<imaccount>::iterator ia;
for(ia = accounts.begin(); ia != accounts.end(); ++ia)
--- centericq-22-07/src/icqconf.h 2006-07-22 17:34:52.000000000 +0200
+++ centericq-22-07-resizeable/src/icqconf.h 2006-07-24 18:26:36.000000000 +0200
@@ -85,7 +85,13 @@
key_show_urls,
key_rss_check,
key_multiple_recipients,
- key_user_external_action
+ key_user_external_action,
+ key_left_panel_move_right,
+ key_left_panel_move_left,
+ key_log_panel_move_up,
+ key_log_panel_move_down,
+ key_chat_panel_move_up,
+ key_chat_panel_move_down
};
class icqconf {
@@ -156,6 +162,9 @@
regcolor rc;
groupmode fgroupmode;
colormode cm;
+ int leftpanelwidth;
+ int logpanelheight;
+ int chatpanelheight;
colorschemer<cicq_colorpairs> schemer;
@@ -310,6 +319,13 @@
bool getxtitles() const { return !notitles; }
bool getdebug() const { return debug; }
+
+ int getleftpanelwidth() const { return leftpanelwidth; }
+ void setleftpanelwidth(const int width) { leftpanelwidth = width; }
+ int getlogpanelheight() const { return logpanelheight; }
+ void setlogpanelheight(const int height) { logpanelheight = height; }
+ int getchatpanelheight() const { return chatpanelheight; }
+ void setchatpanelheight(const int height) { chatpanelheight = height; }
};
extern icqconf conf;
--- centericq-22-07/src/icqdialogs.cc 2006-07-22 17:34:52.000000000 +0200
+++ centericq-22-07-resizeable/src/icqdialogs.cc 2006-07-25 20:57:12.000000000 +0200
@@ -1087,6 +1087,7 @@
bool icqface::updateconf(icqconf::regsound &s, icqconf::regcolor &c) {
bool finished, success, hasany;
int nopt, n, i, b, nconf, ncomm, aaway, ana, noth, nfeat, ncl;
+ bool needredraw = false;
protocolname pname;
string tmp, phidden;
@@ -1178,6 +1179,9 @@
i = t.addnode(_(" User interface "));
t.addleaff(i, 0, 1, _(" Change sound device to : %s "), strregsound(s));
t.addleaff(i, 0, 2, _(" Change color scheme to : %s "), strregcolor(c));
+ t.addleaff(i, 0, 31, _(" Left panel width : %d "), conf.getleftpanelwidth());
+ t.addleaff(i, 0, 32, _(" Log panel height : %d "), conf.getlogpanelheight());
+ t.addleaff(i, 0, 33, _(" Chat panel height : %d "), conf.getchatpanelheight());
#ifdef USE_FRIBIDI
t.addleaff(i, 0, 20, _( " Enable bidirectional languages support : %s "), stryesno(bidi));
@@ -1377,6 +1381,22 @@
break;
case 30:
cm = (cm == icqconf::cmproto ? icqconf::cmstatus : icqconf::cmproto );
+ break;
+ case 31:
+ conf.setleftpanelwidth(atol(inputstr(_("Left panel width: "),
+ strint(conf.getleftpanelwidth())).c_str()));
+ needredraw = true;
+ break;
+ case 32:
+ conf.setlogpanelheight(atol(inputstr(_("Log panel height: "),
+ strint(conf.getlogpanelheight())).c_str()));
+ needredraw = true;
+ break;
+ case 33:
+ conf.setchatpanelheight(atol(inputstr(_("Chat panel height: "),
+ strint(conf.getchatpanelheight())).c_str()));
+ needredraw = true;
+ break;
}
break;
case 1:
@@ -1422,8 +1442,13 @@
}
db.close();
+
+ if(needredraw)
+ icqface::redraw();
+
unblockmainscreen();
+
return success;
}
--- centericq-22-07/src/icqface.cc 2006-07-22 17:34:52.000000000 +0200
+++ centericq-22-07-resizeable/src/icqface.cc 2006-07-25 22:55:32.000000000 +0200
@@ -153,16 +153,29 @@
sizeBigDlg.width = COLS-10;
sizeBigDlg.height = LINES-7;
- sizeWArea.x1 = (int) (COLS*0.32);
- if(sizeWArea.x1 < 25)
- sizeWArea.x1 = 25;
-
+ sizeWArea.x1 = conf.getleftpanelwidth();
+ if(sizeWArea.x1 < MinPanelWidth || sizeWArea.x1 > (COLS - MinPanelWidth)) {
+ sizeWArea.x1 = (int) (COLS*0.32);
+ conf.setleftpanelwidth(sizeWArea.x1);
+ }
+ if(sizeWArea.x1 < MinPanelWidth || sizeWArea.x1 > (COLS - MinPanelWidth)) {
+ sizeWArea.x1 = MinPanelWidth;
+ conf.setleftpanelwidth(sizeWArea.x1);
+ }
+
sizeWArea.x2 = COLS-1;
sizeWArea.y1 = 1;
- sizeWArea.y2 = LINES - ((int) (LINES/4));
- if(sizeWArea.y2 > LINES-6)
- sizeWArea.y2 = LINES-6;
+ sizeWArea.y2 = conf.getlogpanelheight();
+ if(sizeWArea.y2 < MinPanelHeight || sizeWArea.y2 > (LINES - MinPanelHeight)) {
+ sizeWArea.y2 = (int) LINES / 4;
+ conf.setlogpanelheight(sizeWArea.y2);
+ }
+ if(sizeWArea.y2 < MinPanelHeight || sizeWArea.y2 > (LINES - MinPanelHeight)) {
+ sizeWArea.y2 = MinPanelHeight;
+ conf.setlogpanelheight(sizeWArea.y2);
+ }
+ sizeWArea.y2 = LINES - sizeWArea.y2;
if(!mcontacts) {
mcontacts = new treeview(conf.getcolor(cp_main_menu),
@@ -2680,7 +2693,16 @@
muins.clear();
muins.push_back(passinfo);
- chatlines = (int) ((sizeWArea.y2-sizeWArea.y1)*0.75);
+ chatlines = conf.getchatpanelheight();
+ if (chatlines < MinPanelHeight || chatlines > (LINES - MinPanelHeight - MinPanelHeight)){
+ chatlines = (int) ((sizeWArea.y2-sizeWArea.y1)*0.70);
+ conf.setchatpanelheight(chatlines);
+ }
+ if (chatlines < MinPanelHeight || chatlines > (LINES - MinPanelHeight - MinPanelHeight)){
+ chatlines = MinPanelHeight;
+ conf.setchatpanelheight(chatlines);
+ }
+
// workarealine(sizeWArea.y1+chatlines+1);
editor.addscheme(cp_main_text, cp_main_text, 0, 0);
@@ -3315,6 +3337,22 @@
if(c) face.extk = ACT_IGNORE;
break;
+ case key_left_panel_move_right:
+ face.leftpanelwidth_inc(1);
+ break;
+
+ case key_left_panel_move_left:
+ face.leftpanelwidth_inc(-1);
+ break;
+
+ case key_log_panel_move_up:
+ face.logpanelheight_inc(1);
+ break;
+
+ case key_log_panel_move_down:
+ face.logpanelheight_inc(-1);
+ break;
+
case key_quickfind: face.extk = ACT_QUICKFIND; break;
}
@@ -3407,6 +3445,12 @@
if(face.passevent)
face.fullscreenize(face.passevent);
break;
+ case key_chat_panel_move_up:
+ face.chatpanelheight_inc(1);
+ break;
+ case key_chat_panel_move_down:
+ face.chatpanelheight_inc(-1);
+ break;
case key_quit:
return -1;
}
@@ -3574,3 +3618,31 @@
void icqface::icqprogress::hide() {
w->close();
}
+
+void icqface::leftpanelwidth_inc(const int inc) {
+ int i = conf.getleftpanelwidth();
+ if ( ((i+inc) >= MinPanelWidth) && ((i+inc) <= (COLS - MinPanelWidth))) {
+ conf.setleftpanelwidth(i+inc);
+ dotermresize = true ;
+ }
+}
+
+void icqface::logpanelheight_inc(const int inc) {
+ int i = conf.getlogpanelheight();
+ if (((i+inc) >= MinPanelHeight) && ((i+inc) <= (LINES - MinPanelHeight))) {
+ conf.setlogpanelheight(i+inc);
+ dotermresize = true ;
+ }
+}
+
+void icqface::chatpanelheight_inc(const int inc ) {
+ chatlines = conf.getchatpanelheight()+inc;
+ conf.setchatpanelheight(chatlines);
+ if(!(( chatlines > 0 ) && (chatlines < (sizeWArea.y2-sizeWArea.y1)*0.90) ) ){
+ chatlines = (int) ((sizeWArea.y2-sizeWArea.y1)*0.70);
+ conf.setchatpanelheight(chatlines);}
+
+ icqface::renderchathistory();
+ icqface::restoreworkarea();
+}
+
--- centericq-22-07/src/icqface.h 2006-07-22 17:34:52.000000000 +0200
+++ centericq-22-07-resizeable/src/icqface.h 2006-07-24 23:19:40.000000000 +0200
@@ -129,6 +129,9 @@
static void transferidle(dialogbox &db);
static void editchatidle(texteditor &e);
+ static const unsigned int MinPanelWidth = 10;
+ static const unsigned int MinPanelHeight = 10;
+
static void termresize(void);
void infoclear(dialogbox &db, icqcontact *c, const imcontact realdesc);
@@ -284,6 +287,9 @@
void userinfoexternal(const imcontact &ic);
bool selectpgpkey(string &keyid, bool secretonly = false);
+ void leftpanelwidth_inc(const int inc);
+ void logpanelheight_inc(const int inc);
+ void chatpanelheight_inc(const int inc);
};
extern icqface face;