Re: [patch] panel resizing

Stephen <z35_11-/[email protected]>
Newsgroups gmane.network.centericq
Message-ID <[email protected]>
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
(resizing the chat window), which is still borken and
I am lost on how to continue. I do not know how to go
about redrawing the editor. It might be a while until
I get back to it, so I figured I will see if anybody
can come up with a solution. You can always resize,
<esc><esc><enter> to redraw it ... for now. 

Stephen

--- Stephen <z35_11-/[email protected]> wrote:

> It does not work, I removed the redraw, and manually
> typed '^l' and nothing happened. 
> 
> --- Mark Pustjens <[email protected]> wrote:
> 
> > > Thanks to Alexander Fenster for getting it
> > started...
> > > After Mark Pustjens' patches (might work before,
> I
> > am
> > > not certain)
> > 
> > Depending on the files which your patch modifies
> it
> > should just work. (as 
> > long as you do not modify the msn files and
> > src/hooks/msnhook* files and 
> > the various configuration scripts)
> > 
> > > $ patch -p0 -i <patch>
> > > and configure and make like usual
> > >
> > > add to keybindings:
> > > bind contact    [       left_panel_move_left
> > > bind contact    ]       left_panel_move_right
> > > bind contact    {       hist_panel_move_up
> > > bind contact    }       hist_panel_move_down
> > >
> > > add to config (not required):
> > > left_panel_width        24
> > > hist_panel_height       24
> > >
> > > or something like that...
> > >
> > > Patch is attached, For some reason I cannot
> paste
> > it
> > > in the forums...
> > >
> > > and the history is not re-written, I don't know
> > how to
> > > do that or if it is possible...
> > >
> > 
> > ^L redraws the screen. perhaps you can check what
> > fuction is called for 
> > this key combo and call that on resize

"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-panel_sizing-dyn0.patch (application/octet-stream, 9.6 KB)
diff -Nu src.org/icqconf.cc src/icqconf.cc
--- src.org/icqconf.cc	2006-07-23 10:50:07.000000000 -0400
+++ src/icqconf.cc	2006-07-23 17:23:44.000000000 -0400
@@ -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)
diff -Nu src.org/icqconf.h src/icqconf.h
--- src.org/icqconf.h	2006-07-23 10:50:08.000000000 -0400
+++ src/icqconf.h	2006-07-23 17:25:11.000000000 -0400
@@ -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;
diff -Nu src.org/icqdialogs.cc src/icqdialogs.cc
--- src.org/icqdialogs.cc	2006-07-23 10:50:04.000000000 -0400
+++ src/icqdialogs.cc	2006-07-23 17:27:27.000000000 -0400
@@ -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:
@@ -1424,6 +1444,9 @@
     db.close();
     unblockmainscreen();
 
+    if(needredraw)
+	    icqface::redraw();
+
     return success;
 }
 
diff -Nu src.org/icqface.cc src/icqface.cc
--- src.org/icqface.cc	2006-07-23 10:50:08.000000000 -0400
+++ src/icqface.cc	2006-07-23 21:31:05.000000000 -0400
@@ -153,16 +153,24 @@
     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 > 0 && sizeWArea.x1 < COLS)){
+	sizeWArea.x1 = (int) (COLS*0.32); 
+	conf.setleftpanelwidth(sizeWArea.x1);}
+    if(sizeWArea.x1 < 20) {
+	sizeWArea.x1 = 20;
+	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 - conf.getlogpanelheight();
+    if(!(sizeWArea.y2 > 0 && sizeWArea.y2 < LINES)){
+	sizeWArea.y2 = LINES - ((int) LINES/4) ;
+	conf.setlogpanelheight(sizeWArea.y2);}
+    if(sizeWArea.y2 > LINES-6) {
 	sizeWArea.y2 = LINES-6;
+	conf.setlogpanelheight(sizeWArea.y2);}
 
     if(!mcontacts) {
 	mcontacts = new treeview(conf.getcolor(cp_main_menu),
@@ -2680,7 +2688,11 @@
     muins.clear();
     muins.push_back(passinfo);
 
-    chatlines = (int) ((sizeWArea.y2-sizeWArea.y1)*0.75);
+    chatlines = conf.getchatpanelheight();
+    if(!(( chatlines > 0 ) && (chatlines < (sizeWArea.y2-sizeWArea.y1)*0.90) ) ){
+        chatlines = (int) ((sizeWArea.y2-sizeWArea.y1)*0.70);
+	conf.setchatpanelheight(chatlines);}
+
 //    workarealine(sizeWArea.y1+chatlines+1);
 
     editor.addscheme(cp_main_text, cp_main_text, 0, 0);
@@ -3315,6 +3327,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 +3435,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 +3608,25 @@
 void icqface::icqprogress::hide() {
     w->close();
 }
+
+void icqface::leftpanelwidth_inc(const int inc) {
+    conf.setleftpanelwidth(conf.getleftpanelwidth()+inc);
+    dotermresize = true ;
+}
+
+void icqface::logpanelheight_inc(const int inc) {
+    conf.setlogpanelheight(conf.getlogpanelheight()+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();
+}
+
diff -Nu src.org/icqface.h src/icqface.h
--- src.org/icqface.h	2006-07-23 10:50:08.000000000 -0400
+++ src/icqface.h	2006-07-23 17:45:13.000000000 -0400
@@ -284,6 +284,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;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.