<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>暖暖的梦 &#187; C</title>
	<atom:link href="http://wqos.net/category/c/feed/" rel="self" type="application/rss+xml" />
	<link>http://wqos.net</link>
	<description>梦中我微笑着 梦着我的记忆</description>
	<lastBuildDate>Mon, 23 Jan 2012 09:12:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>基本能用了</title>
		<link>http://wqos.net/2010/09/basic-can-used/</link>
		<comments>http://wqos.net/2010/09/basic-can-used/#comments</comments>
		<pubDate>Wed, 01 Sep 2010 13:15:45 +0000</pubDate>
		<dc:creator>婉秋</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[GTK+]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://wqos.net/?p=686</guid>
		<description><![CDATA[第一个有点用的程序，上一篇日志里有出现过。 作用是给plink弄个简单的图形前端，直接输入基本信息就能通过SSH上网，映射端口固定为7070。因为是第一次写程序，不知道的东西太多了，慢慢摸索吧，代码写的也不是很有条理，这个程序就作为我学习GTK+的一个过程吧，说实在的，用shell脚本非常方便 。 接下来看图说话吧 1、主界面如下，在docky有一个模糊的程序图标，不知道怎么弄大，我的图标文件很大的…… 程序在运行时会载入上一次所填写的内容，不需要再次填写。而那些内容保存在程序同一个文件夹下。 2、“连接”按钮在plink连接后会变为“断开” 3、最小化后缩小到通知区域 4、右键可控制断开或是退出程序 接下来的想法就是，把“连接“那个双态按钮改成普通按钮，并且设置点击该按钮可以直接最小化到通知区域。 再改改咯，嘻嘻]]></description>
			<content:encoded><![CDATA[<p>第一个有点用的程序，上一篇日志里有出现过。</p>
<p>作用是给plink弄个简单的图形前端，直接输入基本信息就能通过SSH上网，映射端口固定为7070。因为是第一次写程序，不知道的东西太多了，慢慢摸索吧，代码写的也不是很有条理，<span style="color: #800000;">这个程序就作为我学习GTK+的一个过程吧</span>，说实在的，用shell脚本非常方便 <img src='http://wqos.net/wp-includes/images/smilies/icon_neutral.gif' alt=':neutral:' class='wp-smiley' />  。</p>
<p><span id="more-686"></span></p>
<p>接下来看图说话吧</p>
<p>1、主界面如下，在docky有一个模糊的程序图标，不知道怎么弄大，我的图标文件很大的……</p>
<p>程序在运行时会载入上一次所填写的内容，不需要再次填写。而那些内容保存在程序同一个文件夹下。</p>
<p><img class="aligncenter" src="http://lujg4w.blu.livefilestore.com/y1pLPHLWjaBMdq3xZRpBLbdiH3ZsUv0ikD-Z_xS0ise92Klm2wyufimA2hWELO-HTxrG52vv-_kyVMorcC_yIKPxz7TiUKt1Evk/Screenshot-3.png" alt="" width="289" height="336" /></p>
<p>2、“连接”按钮在plink连接后会变为“断开”</p>
<p><img class="aligncenter" src="http://lujg4w.blu.livefilestore.com/y1p73d11CduOmy_1eqOpefcpq79eQ2J4OuLayH9Bvjew1m-337TBMquzeHN1vzTNMNn-qSONcDfCl5yBARr0m_HrFdH2AYbPoe8/Screenshot-4.png" alt="" width="521" height="301" /></p>
<p>3、最小化后缩小到通知区域</p>
<p><img class="aligncenter" src="http://lujg4w.blu.livefilestore.com/y1pnh1HEErtq6WTjakAmV-Tuw3oEry7uvPqz_OzyJS-Vf56qH5FKd6lZUgWAueNIQ3NyMW_GsRPkxhro6edbDKZGVAjdXJ4cwyn/Screenshot-5.png" alt="" width="63" height="41" /></p>
<p>4、右键可控制断开或是退出程序</p>
<p><img class="aligncenter" src="http://lujg4w.blu.livefilestore.com/y1pnh1HEErtq6WPqFq8chJ-j-3mGgp249eJWK35nR6R5YwixxXcFRMOqDMJz7fUXQgfyzdt-il4NEyc7cKc9mfeeQt9VjU9ZI23/Screenshot-7.png" alt="" width="93" height="82" /></p>
<p>接下来的想法就是，把“连接“那个双态按钮改成普通按钮，并且设置点击该按钮可以直接最小化到通知区域。</p>
<p>再改改咯，嘻嘻</p>
]]></content:encoded>
			<wfw:commentRss>http://wqos.net/2010/09/basic-can-used/feed/</wfw:commentRss>
		<slash:comments>68</slash:comments>
		</item>
		<item>
		<title>今天我生日</title>
		<link>http://wqos.net/2010/08/today-is-my-birthday/</link>
		<comments>http://wqos.net/2010/08/today-is-my-birthday/#comments</comments>
		<pubDate>Sun, 29 Aug 2010 16:01:42 +0000</pubDate>
		<dc:creator>婉秋</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[随便说说]]></category>
		<category><![CDATA[GTK+]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://wqos.net/?p=681</guid>
		<description><![CDATA[RT ===================================================== 嗯，做了个很简单的小玩意，就是给plink弄了一个外壳，可以不用在终端下输入命令就能把SSH做代理…… 现在只能算姑且能用，只能连接不能断开，且时有无响应的问题发生，但不影响plink的工作。 其实用shell脚本更方便，我平常就是用sh脚本，做这个只是无聊罢了……]]></description>
			<content:encoded><![CDATA[<p>RT <img src='http://wqos.net/wp-includes/images/smilies/icon_mrgreen.gif' alt=':mrgreen:' class='wp-smiley' /> </p>
<p style="text-align: center;">=====================================================</p>
<p>嗯，做了个很简单的小玩意，就是给plink弄了一个外壳，可以不用在终端下输入命令就能把SSH做代理……<br />
现在只能算姑且能用，只能连接不能断开，且时有无响应的问题发生，但不影响plink的工作。<br />
其实用shell脚本更方便，我平常就是用sh脚本，做这个只是无聊罢了……</p>
<p><img class="aligncenter" src="http://lugphg.blu.livefilestore.com/y1pnwzuuS3WyLLmUelQV_ewumNdHxGyKPE9yyueS4wZGdfii8hWNW3bJ1g4a_EkDyXAWZHE_NKbe0f4SMPLwLhhgGNTx7QxHGf0/2010-08-29_235653.png" alt="" width="290" height="256" /></p>
]]></content:encoded>
			<wfw:commentRss>http://wqos.net/2010/08/today-is-my-birthday/feed/</wfw:commentRss>
		<slash:comments>84</slash:comments>
		</item>
		<item>
		<title>glade3使用回调函数</title>
		<link>http://wqos.net/2010/07/glade3-use-callback/</link>
		<comments>http://wqos.net/2010/07/glade3-use-callback/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 02:18:15 +0000</pubDate>
		<dc:creator>婉秋</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[GTK+]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://wqos.net/?p=638</guid>
		<description><![CDATA[假设要给window的destroy信号连接一个名为on_window_destroy的回调函数。 直接在glade3中的“操作句柄”设置回调函数“on_window_destroy”，若通过 gcc -o 目标程序名 源文件名.c `pkg-config &#8211;cflags &#8211;libs libglade-2.0` 编译可以通过，但运行是会发生 Gtk-WARNING **: Could not find signal handler &#8216;回调函数名称&#8217; 这样的错误。 需要使用 gcc -o 目标程序名 源文件名.c `pkg-config &#8211;cflags &#8211;libs libglade-2.0` -export-dynamic 来编译才可以正确执行。 点击“帮助”——“关于”菜单时弹出“关于”对话框，就是利用对菜单的activate设置回调函数来实现的。如下图：]]></description>
			<content:encoded><![CDATA[<p>假设要给window的destroy信号连接一个名为<span style="color: #800000;">on_window_destroy</span>的回调函数。</p>
<p>直接在glade3中的“操作句柄”设置回调函数“<span style="color: #800000;">on_window_destroy</span>”，若通过</p>
<p><span style="color: #800000;">gcc -o 目标程序名 源文件名.c `pkg-config &#8211;cflags &#8211;libs libglade-2.0`</span></p>
<p>编译可以通过，但运行是会发生</p>
<p><span style="color: #800000;">Gtk-WARNING **: Could not find signal handler &#8216;回调函数名称&#8217;</span></p>
<p>这样的错误。</p>
<p>需要使用</p>
<p><span style="color: #800000;">gcc -o 目标程序名 源文件名.c `pkg-config &#8211;cflags &#8211;libs  libglade-2.0` -export-dynamic</span></p>
<p>来编译才可以正确执行。</p>
<p>点击“帮助”——“关于”菜单时弹出“关于”对话框，就是利用对菜单的activate设置回调函数来实现的。如下图：</p>
<p><img class="aligncenter" src="http://lugphg.blu.livefilestore.com/y1pJXBQXcV06ReB3aoHbnN02KnpQuAOW45w7GhK7d5VqL7mKoPnHZthVcc22RIp8Fiym3VqHtiT3z6-wUNvXd4W6vxqcahVM4Eg/%E5%9B%9E%E8%B0%83%E5%87%BD%E6%95%B0%E7%A4%BA%E4%BE%8B.png" alt="" width="459" height="284" /></p>
]]></content:encoded>
			<wfw:commentRss>http://wqos.net/2010/07/glade3-use-callback/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>初次使用Glade3</title>
		<link>http://wqos.net/2010/07/first-use-glade3/</link>
		<comments>http://wqos.net/2010/07/first-use-glade3/#comments</comments>
		<pubDate>Thu, 15 Jul 2010 14:39:00 +0000</pubDate>
		<dc:creator>婉秋</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[GTK+]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://wqos.net/?p=627</guid>
		<description><![CDATA[Glade是用来设计Gtk+程序界面的工具，暑假才开始学习Gtk+，看着代码好多，特别要写菜单的时候，真的很麻烦，更糟糕的是照着我那本从图书馆借来的指导书上写是错的……一直在Warning，虽然编译凑合着过了，但是界面有错，和我构想的差距太大。 在网上查找原因时发现了这个软件，摸索了一下，终于出了一个简易的界面。 首先在Glade3中设计一个简单的界面。从图上可以看出，这个界面有一个叫做“window”的窗口，接着窗口下有个垂直排布的盒状容器“vbox”，盒子的最上头放着一个叫做“menubar”的菜单栏，菜单栏里有若干菜单就不管它了…… 在“window”的“信号”标签下，在“GtkWidget”类中找到“delete-event”，为其“操作句柄”选择为“gtk_main_quit”。同样，在“GtkObject”类的“destory”也选择“gtk_main_quit”。这样做的目的是在用鼠标点击窗口上的“X”时可以正常退出程序，否则只能关闭图形界面，程序依旧在运行。 然后保存为*.glade文件。 再然后就是在glade文件相同目录下建立一个C源码文件。 文件如下： 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 #include &#60;gtk/gtk.h&#62; int main&#40;int argc,char* argv&#91;&#93;&#41; &#123; GtkBuilder *builder; GtkWidget *window; GtkWidget *vbox; GtkWidget *menubar; gtk_init &#40;&#38;argc,&#38;argv&#41;; builder=gtk_builder_new&#40;&#41;; gtk_builder_get_object&#40;builder,&#34;window&#34;&#41;; gtk_builder_add_from_file&#40;builder,&#34;文件名.glade&#34;,NULL&#41;; window=GTK_WIDGET&#40;gtk_builder_get_object&#40;builder,&#34;window&#34;&#41;&#41;; vbox=GTK_WIDGET&#40;gtk_builder_get_object&#40;builder,&#34;vbox&#34;&#41;&#41;; menubar=GTK_WIDGET&#40;gtk_builder_get_object&#40;builder,&#34;menubar&#34;&#41;&#41;; gtk_builder_connect_signals&#40;builder,NULL&#41;; g_object_unref&#40;G_OBJECT&#40;builder&#41;&#41;; gtk_widget_show_all&#40;window&#41;; gtk_main&#40;&#41;; return [...]]]></description>
			<content:encoded><![CDATA[<p>Glade是用来设计Gtk+程序界面的工具，暑假才开始学习Gtk+，看着代码好多，特别要写菜单的时候，真的很麻烦，更糟糕的是照着我那本从图书馆借来的指导书上写是错的……一直在Warning，虽然编译凑合着过了，但是界面有错，和我构想的差距太大。</p>
<p>在网上查找原因时发现了这个软件，摸索了一下，终于出了一个简易的界面。<br />
<span id="more-627"></span></p>
<p>首先在Glade3中设计一个简单的界面。从图上可以看出，这个界面有一个叫做“window”的窗口，接着窗口下有个垂直排布的盒状容器“vbox”，盒子的最上头放着一个叫做“menubar”的菜单栏，菜单栏里有若干菜单就不管它了……</p>
<p><a href="http://lugphg.blu.livefilestore.com/y1pYH7WNN6MDkvMuD2KVslIo2mlSlS00ZtGl6AXtYfQ10u0VhVxixl0OcSFU5ADRSBhp6SwZrGr3vuyBMPKI96C6SXg-FUNChyh/%E4%B8%80%E4%B8%AA%E6%9C%80%E5%9F%BA%E6%9C%AC%E7%9A%84%E7%AA%97%E5%8F%A3.png" rel="shadowbox[sbpost-627];player=img;" target="_blank"><img class="aligncenter" src="http://lugphg.blu.livefilestore.com/y1pYH7WNN6MDkvMuD2KVslIo2mlSlS00ZtGl6AXtYfQ10u0VhVxixl0OcSFU5ADRSBhp6SwZrGr3vuyBMPKI96C6SXg-FUNChyh/%E4%B8%80%E4%B8%AA%E6%9C%80%E5%9F%BA%E6%9C%AC%E7%9A%84%E7%AA%97%E5%8F%A3.png" alt="" width="896" height="560" /></a></p>
<p>在“window”的“信号”标签下，在“GtkWidget”类中找到“delete-event”，为其“操作句柄”选择为“gtk_main_quit”。同样，在“GtkObject”类的“destory”也选择“gtk_main_quit”。这样做的目的是在用鼠标点击窗口上的“X”时可以正常退出程序，否则只能关闭图形界面，程序依旧在运行。</p>
<p>然后保存为*.glade文件。</p>
<p>再然后就是在glade文件相同目录下建立一个C源码文件。</p>
<p>文件如下：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
</pre></td><td class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#include &lt;gtk/gtk.h&gt;</span>
<span style="color: #993333;">int</span> main<span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> argc<span style="color: #339933;">,</span><span style="color: #993333;">char</span><span style="color: #339933;">*</span> argv<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	GtkBuilder <span style="color: #339933;">*</span>builder<span style="color: #339933;">;</span>
	GtkWidget <span style="color: #339933;">*</span>window<span style="color: #339933;">;</span>
	GtkWidget <span style="color: #339933;">*</span>vbox<span style="color: #339933;">;</span>
	GtkWidget <span style="color: #339933;">*</span>menubar<span style="color: #339933;">;</span>
	gtk_init <span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span>argc<span style="color: #339933;">,&amp;</span>argv<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	builder<span style="color: #339933;">=</span>gtk_builder_new<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	gtk_builder_get_object<span style="color: #009900;">&#40;</span>builder<span style="color: #339933;">,</span><span style="color: #ff0000;">&quot;window&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	gtk_builder_add_from_file<span style="color: #009900;">&#40;</span>builder<span style="color: #339933;">,</span><span style="color: #ff0000;">&quot;文件名.glade&quot;</span><span style="color: #339933;">,</span>NULL<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	window<span style="color: #339933;">=</span>GTK_WIDGET<span style="color: #009900;">&#40;</span>gtk_builder_get_object<span style="color: #009900;">&#40;</span>builder<span style="color: #339933;">,</span><span style="color: #ff0000;">&quot;window&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	vbox<span style="color: #339933;">=</span>GTK_WIDGET<span style="color: #009900;">&#40;</span>gtk_builder_get_object<span style="color: #009900;">&#40;</span>builder<span style="color: #339933;">,</span><span style="color: #ff0000;">&quot;vbox&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	menubar<span style="color: #339933;">=</span>GTK_WIDGET<span style="color: #009900;">&#40;</span>gtk_builder_get_object<span style="color: #009900;">&#40;</span>builder<span style="color: #339933;">,</span><span style="color: #ff0000;">&quot;menubar&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	gtk_builder_connect_signals<span style="color: #009900;">&#40;</span>builder<span style="color: #339933;">,</span>NULL<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	g_object_unref<span style="color: #009900;">&#40;</span>G_OBJECT<span style="color: #009900;">&#40;</span>builder<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	gtk_widget_show_all<span style="color: #009900;">&#40;</span>window<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	gtk_main<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>其中</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="c" style="font-family:monospace;">	GtkWidget <span style="color: #339933;">*</span>window<span style="color: #339933;">;</span>
	GtkWidget <span style="color: #339933;">*</span>vbox<span style="color: #339933;">;</span>
	GtkWidget <span style="color: #339933;">*</span>menubar<span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>就是声明刚才的组件变量。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="c" style="font-family:monospace;">	window<span style="color: #339933;">=</span>GTK_WIDGET<span style="color: #009900;">&#40;</span>gtk_builder_get_object<span style="color: #009900;">&#40;</span>builder<span style="color: #339933;">,</span><span style="color: #ff0000;">&quot;window&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	vbox<span style="color: #339933;">=</span>GTK_WIDGET<span style="color: #009900;">&#40;</span>gtk_builder_get_object<span style="color: #009900;">&#40;</span>builder<span style="color: #339933;">,</span><span style="color: #ff0000;">&quot;vbox&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	menubar<span style="color: #339933;">=</span>GTK_WIDGET<span style="color: #009900;">&#40;</span>gtk_builder_get_object<span style="color: #009900;">&#40;</span>builder<span style="color: #339933;">,</span><span style="color: #ff0000;">&quot;menubar&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>通过这些组件的名字从刚才建立的glade文件中调用相应的组件。</p>
<p>编译运行就是这样的了！</p>
<p style="text-align: center;"><a href="http://lugphg.blu.livefilestore.com/y1pPP0Zv0TV5OLE5kx56v9j787cA_XQpeQx-g6r9BZP_VEg_zEzFAGftYT9m7W6JKs57pHLuRT4HzCQRVAALfsFIbSwd-F0AWDY/%E5%AE%8C%E6%88%90%E5%90%8E%E7%9A%84%E6%A8%A1%E6%A0%B7.png" rel="shadowbox[sbpost-627];player=img;" target="_blank"><img class="aligncenter" src="http://lugphg.blu.livefilestore.com/y1pPP0Zv0TV5OLE5kx56v9j787cA_XQpeQx-g6r9BZP_VEg_zEzFAGftYT9m7W6JKs57pHLuRT4HzCQRVAALfsFIbSwd-F0AWDY/%E5%AE%8C%E6%88%90%E5%90%8E%E7%9A%84%E6%A8%A1%E6%A0%B7.png" alt="" width="458" height="283" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://wqos.net/2010/07/first-use-glade3/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>hello world</title>
		<link>http://wqos.net/2010/07/hello-world-2/</link>
		<comments>http://wqos.net/2010/07/hello-world-2/#comments</comments>
		<pubDate>Mon, 12 Jul 2010 12:02:45 +0000</pubDate>
		<dc:creator>婉秋</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[GTK+]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://wqos.net/?p=615</guid>
		<description><![CDATA[用GTK+写出的第一个“hello world”，纪念下 居然区别大小写……哎，很不方便，因为要切换大小写。]]></description>
			<content:encoded><![CDATA[<p>用GTK+写出的第一个“hello world”，纪念下 <img src='http://wqos.net/wp-includes/images/smilies/icon_neutral.gif' alt=':neutral:' class='wp-smiley' /> </p>
<p>居然区别大小写……哎，很不方便，因为要切换大小写。</p>
<p style="text-align: center;"><a href="http://lugphg.blu.livefilestore.com/y1pcGythy8E5nOpMZTOUB3I4NOwcN90vea_RBp7--lmG77a2bIMDxqPJnlTeuAH9XI7AA48YDUvJOtZZUywz7_-wPFGDqxh4-Tw/gtk_helloworld.png" rel="shadowbox[sbpost-615];player=img;" target="_blank"><img class="aligncenter" src="http://lugphg.blu.livefilestore.com/y1pcGythy8E5nOpMZTOUB3I4NOwcN90vea_RBp7--lmG77a2bIMDxqPJnlTeuAH9XI7AA48YDUvJOtZZUywz7_-wPFGDqxh4-Tw/gtk_helloworld.png" alt="" width="1152" height="720" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://wqos.net/2010/07/hello-world-2/feed/</wfw:commentRss>
		<slash:comments>38</slash:comments>
		</item>
		<item>
		<title>.vimrc</title>
		<link>http://wqos.net/2010/06/my-vimrc/</link>
		<comments>http://wqos.net/2010/06/my-vimrc/#comments</comments>
		<pubDate>Sun, 13 Jun 2010 16:04:27 +0000</pubDate>
		<dc:creator>婉秋</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://wqos.net/?p=565</guid>
		<description><![CDATA[为了C语言而设置，我的.vimrc文件内容（vim版本7.2.330，在ubuntu10.04下安装的） 我也是个初学者，不想照搬网络上已有的配置文件，因此先从最简单的开始吧，离好用还有很大差距。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 &#34;显示行号 set [...]]]></description>
			<content:encoded><![CDATA[<p>为了C语言而设置，我的.vimrc文件内容（vim版本7.2.330，在ubuntu10.04下安装的）</p>
<p>我也是个初学者，不想照搬网络上已有的配置文件，因此先从最简单的开始吧，离好用还有很大差距。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
</pre></td><td class="code"><pre class="vim" style="font-family:monospace;"><span style="color: #adadad; font-style: italic;">&quot;显示行号</span>
<span style="color: #804040;">set</span> <span style="color: #668080;">nu</span><span style="color: #adadad; font-style: italic;">
&nbsp;
&quot; C的编译和运行，按F5</span>
<span style="color: #804040;">map</span> <span style="color: #668080;">&lt;F5&gt;</span> <span style="color: #000000;">:</span><span style="color: #804040;">call</span> CompileRunGcc<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #804040;">func</span><span style="color: #000000;">!</span> CompileRunGcc<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #804040;">exec</span> <span style="color: #C5A22D;">&quot;w&quot;</span>
<span style="color: #804040;">exec</span> <span style="color: #C5A22D;">&quot;!gcc -Wall -g % -o %&amp;lt;&quot;</span>
<span style="color: #804040;">exec</span> <span style="color: #C5A22D;">&quot;! ./%&amp;lt;&quot;</span>
endfunc<span style="color: #adadad; font-style: italic;">
&nbsp;
&quot; C++的编译和运行，按F6</span>
<span style="color: #804040;">map</span> <span style="color: #668080;">&lt;F6&gt;</span> <span style="color: #000000;">:</span><span style="color: #804040;">call</span> CompileRunGpp<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #804040;">func</span><span style="color: #000000;">!</span> CompileRunGpp<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #804040;">exec</span> <span style="color: #C5A22D;">&quot;w&quot;</span>
<span style="color: #804040;">exec</span> <span style="color: #C5A22D;">&quot;!g++ -Wall -g % -o %&amp;lt;&quot;</span>
<span style="color: #804040;">exec</span> <span style="color: #C5A22D;">&quot;! ./%&amp;lt;&quot;</span>
endfunc<span style="color: #adadad; font-style: italic;">
&nbsp;
&quot;自动缩进相关</span>
<span style="color: #804040;">set</span> <span style="color: #668080;">autoindent</span>
<span style="color: #804040;">set</span> <span style="color: #25BB4D;">cindent</span><span style="color: #adadad; font-style: italic;">
&nbsp;
&quot;配色</span>
<span style="color: #804040;">colorscheme</span> desert<span style="color: #adadad; font-style: italic;">
&nbsp;
&quot;自动括号补全不一定特别方便，但至少不会把括号忘记了</span>
<span style="color: #000000;">:</span>inoremap <span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>i
<span style="color: #000000;">:</span>inoremap <span style="color: #000000;">&#41;</span> =ClosePair<span style="color: #000000;">&#40;</span><span style="color: #C5A22D;">')'</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">:</span>inoremap <span style="color: #000000;">&#123;</span> <span style="color: #000000;">&#123;</span><span style="color: #000000;">&#125;</span>i
<span style="color: #000000;">:</span>inoremap <span style="color: #000000;">&#125;</span> =ClosePair<span style="color: #000000;">&#40;</span><span style="color: #C5A22D;">'}'</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">:</span>inoremap <span style="color: #000000;">&#91;</span> <span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span>i
<span style="color: #000000;">:</span>inoremap <span style="color: #000000;">&#93;</span> =ClosePair<span style="color: #000000;">&#40;</span><span style="color: #C5A22D;">']'</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">:</span>inoremap <span style="color: #000000;">&amp;</span>lt; <span style="color: #000000;">&amp;</span>lt;<span style="color: #000000;">&amp;</span>gt;i
<span style="color: #000000;">:</span>inoremap <span style="color: #000000;">&amp;</span>gt; =ClosePair<span style="color: #000000;">&#40;</span><span style="color: #C5A22D;">'&amp;gt;'</span><span style="color: #000000;">&#41;</span>
<span style="color: #804040;">function</span> ClosePair<span style="color: #000000;">&#40;</span>char<span style="color: #000000;">&#41;</span>
<span style="color: #804040;">if</span> <span style="color: #25BB4D;">getline</span><span style="color: #000000;">&#40;</span><span style="color: #C5A22D;">'.'</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#91;</span><span style="color: #25BB4D;">col</span><span style="color: #000000;">&#40;</span><span style="color: #C5A22D;">'.'</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">-</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#93;</span> == a<span style="color: #000000;">:</span>char
<span style="color: #804040;">return</span> <span style="color: #C5A22D;">&quot;<span style="">\&quot;</span>
else
return a:char
endif
endf
&nbsp;
&quot;</span>Taglist插件和winmanager的设置（需要下载安装这两个插件），按F4显示winmanager<span style="color: #adadad; font-style: italic;">
&quot;据说Taglist需要安装ctags（总之我装了，没验证过），在ubuntu10.04中为exuberant-ctags软件包</span>
<span style="color: #804040;">let</span> g<span style="color: #000000;">:</span>Tlist_Use_Left_Window=<span style="color: #000000; font-weight:bold;">1</span>
<span style="color: #804040;">let</span> g<span style="color: #000000;">:</span>Tlist_Show_One_File=<span style="color: #000000; font-weight:bold;">1</span>
<span style="color: #804040;">let</span> g<span style="color: #000000;">:</span>Tlist_Compact_Format=<span style="color: #000000; font-weight:bold;">1</span>
<span style="color: #804040;">let</span> Tlist_Exit_OnlyWindow=<span style="color: #000000; font-weight:bold;">1</span>
<span style="color: #804040;">let</span> g<span style="color: #000000;">:</span>winManagerWindowLayout=<span style="color: #C5A22D;">'FileExplorer|TagList'</span>
nmap <span style="color: #668080;">&lt;F4&gt;</span> <span style="color: #000000;">:</span>WMToggle</pre></td></tr></table></div>

<p style="text-align: center;">++++++++++++++++++++++++++++++++++++++++++++++++++++</p>
<p style="text-align: center;">插件</p>
<p style="text-align: center;">++++++++++++++++++++++++++++++++++++++++++++++++++++</p>
<p><a href="http://www.vim.org/scripts/script.php?script_id=1338" target="_blank">TabBar</a> 打开多个文档时可以像UE一样有标签的效果..通过alt+1,2,3切换，见<strong>效果图3</strong></p>
<p><a href="  	http://www.vim.org/scripts/script.php?script_id=95" target="_blank">WinManager</a> 文件管理和窗口管理器，见<strong>效果图3</strong></p>
<p><a href="http://www.vim.org/scripts/script.php?script_id=273" target="_blank">TagList</a> 显示代码中的函数、类、变量等等，见<strong>效果图3</strong></p>
<p><span id="more-565"></span></p>
<p>效果图1（设置了行号，C语言自动缩进，配色是desert；默认有括号配对和语法高亮），程序是随便写的，为了演示下而已，功能是取20个数的最大最小值。</p>
<p style="text-align: center;"><a href="http://ptm4qq.blu.livefilestore.com/y1p-NUVi-Liu8OUhn5cI4LBinTUO8F-E1CWrKUqEBFCbysXVnucR8W3CwKxoCRN5s7saeDbXgvVzPgrtAPxiQL6P1zAKHlTBzCD/2010-06-13_234253.png" rel="shadowbox[sbpost-565];player=img;" target="_blank"><img class="aligncenter" src="http://ptm4qq.blu.livefilestore.com/y1p-NUVi-Liu8OUhn5cI4LBinTUO8F-E1CWrKUqEBFCbysXVnucR8W3CwKxoCRN5s7saeDbXgvVzPgrtAPxiQL6P1zAKHlTBzCD/2010-06-13_234253.png" alt="" width="610" height="458" /></a></p>
<p>效果图2（按F5，调用gcc编译并运行，直接在GVIM的窗口内运行，还是蛮方便的）</p>
<p style="text-align: center;"><a href="http://ptm4qq.blu.livefilestore.com/y1p-NUVi-Liu8Nw1xTq1-vRrsGsVoxYZlE6gdHLUgmNXTKPOQbNr-k2fYdNoH7zBhzclP66a56riXPXjt-Je7cO5l8I3T7aVs9A/2010-06-13_234333.png" rel="shadowbox[sbpost-565];player=img;" target="_blank"><img class="aligncenter" src="http://ptm4qq.blu.livefilestore.com/y1p-NUVi-Liu8Nw1xTq1-vRrsGsVoxYZlE6gdHLUgmNXTKPOQbNr-k2fYdNoH7zBhzclP66a56riXPXjt-Je7cO5l8I3T7aVs9A/2010-06-13_234333.png" alt="" width="610" height="458" /></a></p>
<p>效果图3，按F4，调出winmanager，上半部分是文件浏览器，下半部分是Taglist，同时编辑多个文件，上方还有TabBar，用Alt+number来切换各个编辑文件。</p>
<p style="text-align: center;"><a href="http://ptm4qq.blu.livefilestore.com/y1pwR8pf7nYMRYW_KAzaBKARzUn9bDIeiMolPvGIYrZI_IN8jE0yOW6VHhFQoIe6yBTDw8QhHpNqDFhZMBqk4FoUHFLXlP4OSOH/2010-06-14_161533.png" rel="shadowbox[sbpost-565];player=img;" target="_blank"><img class="aligncenter" src="http://ptm4qq.blu.livefilestore.com/y1pwR8pf7nYMRYW_KAzaBKARzUn9bDIeiMolPvGIYrZI_IN8jE0yOW6VHhFQoIe6yBTDw8QhHpNqDFhZMBqk4FoUHFLXlP4OSOH/2010-06-14_161533.png" alt="" width="625" height="458" /></a></p>
<p>先暂时这样，功能好多，乱……慢慢来吧</p>
]]></content:encoded>
			<wfw:commentRss>http://wqos.net/2010/06/my-vimrc/feed/</wfw:commentRss>
		<slash:comments>31</slash:comments>
		</item>
	</channel>
</rss>

