[patch] panel resizing

Stephen <z35_11-/[email protected]>
Newsgroups gmane.network.centericq
Message-ID <[email protected]>
Thanks to Alexander Fenster for getting it started...
After Mark Pustjens' patches (might work before, I am
not certain)

$ 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...


__________________________________________________
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-leftpanel-sizing-dyn3.patch (application/octet-stream, 6.9 KB)
Common subdirectories: src.org/.deps and src/.deps
Common subdirectories: src.org/CVS and src/CVS
Common subdirectories: src.org/hooks and src/hooks
diff -Nau 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 11:16:51.000000000 -0400
@@ -369,8 +369,12 @@
 	    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 == "hist_panel_move_up")    k.action = key_hist_panel_move_up; else
+	    if(param == "hist_panel_move_down")  k.action = key_hist_panel_move_down; else
+		continue;
 
 	    keys.push_back(k);
 	}
@@ -464,6 +468,8 @@
 	    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 == "hist_panel_height") histpanelheight = atol(buf.c_str()); else
 	    if(param == "ptp") {
 		ptpmin = atoi(getword(buf, "-").c_str());
 		ptpmax = atoi(buf.c_str());
@@ -578,6 +584,9 @@
 	    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(gethistpanelheight()) f << "hist_panel_height\t" << gethistpanelheight() << endl;
 
 	    vector<imaccount>::iterator ia;
 	    for(ia = accounts.begin(); ia != accounts.end(); ++ia)
diff -Nau 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 11:19:27.000000000 -0400
@@ -85,7 +85,11 @@
     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_hist_panel_move_up,
+    key_hist_panel_move_down
 };
 
 class icqconf {
@@ -156,6 +160,8 @@
 	regcolor rc;
 	groupmode fgroupmode;
 	colormode cm;
+	int leftpanelwidth;
+	int histpanelheight;
 
 	colorschemer<cicq_colorpairs> schemer;
 
@@ -310,6 +316,11 @@
 
 	bool getxtitles() const { return !notitles; }
 	bool getdebug() const { return debug; }
+	
+	int  getleftpanelwidth() const { return leftpanelwidth; }
+	void setleftpanelwidth(const int width)   { leftpanelwidth  = width; }
+	int  gethistpanelheight() const { return histpanelheight; }
+	void sethistpanelheight(const int height) { histpanelheight = height; }
 };
 
 extern icqconf conf;
diff -Nau 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 11:22:37.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,8 @@
 	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, _(" Left panel height : %d "), conf.gethistpanelheight());
 
     #ifdef USE_FRIBIDI
 	t.addleaff(i, 0, 20, _( " Enable bidirectional languages support : %s "), stryesno(bidi));
@@ -1377,6 +1380,17 @@
 			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.sethistpanelheight(atol(inputstr(_("History panel height: "), 
+				strint(conf.gethistpanelheight())).c_str()));
+			needredraw = true;
+			break;
 		}
 		break;
 	    case 1:
@@ -1424,6 +1438,9 @@
     db.close();
     unblockmainscreen();
 
+    if(needredraw)
+	    icqface::redraw();
+
     return success;
 }
 
diff -Nau 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 11:34:15.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.gethistpanelheight();
+    if(!(sizeWArea.y2 > 0 && sizeWArea.y2 < LINES)){
+	sizeWArea.y2 = LINES - ((int) LINES/4) ;
+	conf.sethistpanelheight(sizeWArea.y2);}
+    if(sizeWArea.y2 > LINES-6) {
 	sizeWArea.y2 = LINES-6;
+	conf.sethistpanelheight(sizeWArea.y2);}
 
     if(!mcontacts) {
 	mcontacts = new treeview(conf.getcolor(cp_main_menu),
@@ -3315,6 +3323,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_hist_panel_move_up:
+	    face.histpanelheight_inc(1);
+	    break;
+       
+	case key_hist_panel_move_down:
+            face.histpanelheight_inc(-1);
+            break;
+
 	case key_quickfind: face.extk = ACT_QUICKFIND; break;
     }
 
@@ -3574,3 +3598,14 @@
 void icqface::icqprogress::hide() {
     w->close();
 }
+
+void icqface::leftpanelwidth_inc(const int inc) {
+       conf.setleftpanelwidth(conf.getleftpanelwidth()+inc);
+       icqface::redraw();
+}
+
+void icqface::histpanelheight_inc(const int inc) {
+       conf.sethistpanelheight(conf.gethistpanelheight()+inc);
+       icqface::redraw();
+}
+
diff -Nau 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 11:34:36.000000000 -0400
@@ -284,6 +284,8 @@
 	void userinfoexternal(const imcontact &ic);
 
 	bool selectpgpkey(string &keyid, bool secretonly = false);
+	void leftpanelwidth_inc(const int inc);
+	void histpanelheight_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.