⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 list.cc

📁 一个功能比较强的下载软件
💻 CC
📖 第 1 页 / 共 4 页
字号:
			   G_CALLBACK (fs_list_allocation), NULL);	/****************************************************************	  Initing signals' handlers for DnD support (added by Justin Bradford)	 ****************************************************************/	// connect the drag-drop signal	g_signal_connect(G_OBJECT(ContainerForCList),	                   "drag_data_received",	                   G_CALLBACK(list_dnd_drop_internal),	                   NULL);	// set the list container as a drop destination	gtk_drag_dest_set(GTK_WIDGET(ContainerForCList),	                  (GtkDestDefaults)(GTK_DEST_DEFAULT_MOTION |	                                    GTK_DEST_DEFAULT_HIGHLIGHT |	                                    GTK_DEST_DEFAULT_DROP),	                  download_drop_types, n_download_drop_types,	                  (GdkDragAction)(GDK_ACTION_COPY|GDK_ACTION_MOVE));	/****************************************************************	    End of second part of DnD code	 ****************************************************************/};/* ******************************************************************* */static void tmp_scroll_title(char *title,int index){	if (CFG.SCROLL_MAINWIN_TITLE){		ScrollShift[index]+=1;		if (ScrollShift[index]>=strlen(title))	ScrollShift[index]=0;		scroll_string_left(title,ScrollShift[index]);	};	};void update_mainwin_title() {	if (CFG.USE_MAINWIN_TITLE) {		mainwin_title_state=1;		tDownload *temp=D4X_QUEUE->qv.last_selected;		char data[MAX_LEN];		char data2[MAX_LEN];		char data3[MAX_LEN];		if (temp){			make_number_nice(data2,temp->Size.curent,D4X_QUEUE->NICE_DEC_DIGITALS);			if (temp->finfo.size>=0)				make_number_nice(data3,temp->finfo.size,D4X_QUEUE->NICE_DEC_DIGITALS);			else				sprintf(data3,"???");			char b[100];			d4x_percent_str(temp->Percent,b,sizeof(b));			char *rfile=unparse_percents(temp->info->file.get());			sprintf(data,"%s%% %s/%s %s ",b,data2,data3,rfile);			delete[] rfile;			dnd_trash_set_tooltip(data,temp->Percent);		}else			dnd_trash_set_tooltip(NULL);		if (temp && (CFG.USE_MAINWIN_TITLE2==0 || UpdateTitleCycle % 3)) {			tmp_scroll_title(data,ROLL_STAT);			gtk_window_set_title(GTK_WINDOW (MainWindow), data);		} else {			if (CFG.USE_MAINWIN_TITLE2) {				sprintf(data,_("[%s] %i-running %i-completed %i-total "),					D4X_QUEUE->name.get(),					D4X_QUEUE->count(DL_RUN),					D4X_QUEUE->count(DL_COMPLETE),					D4X_QUEUE->count());				tmp_scroll_title(data,ROLL_INFO);				gtk_window_set_title(GTK_WINDOW (MainWindow), data);			} else{				gtk_window_set_title(GTK_WINDOW (MainWindow), VERSION_NAME);			};		};	} else{		if (mainwin_title_state){			gtk_window_set_title(GTK_WINDOW (MainWindow), VERSION_NAME);			dnd_trash_set_tooltip(NULL);		};		mainwin_title_state=0;	};};int time_for_refresh(void *a) {	aa.main_circle();	update_progress_bar();	update_mainwin_title();	UpdateTitleCycle+=1;	my_gtk_graph_recalc(GLOBAL_GRAPH);	return 1;};static int _nano_step_=0;static int _nano_stepn_=0;int time_for_logs_refresh(void *a) {	if (_nano_step_)		aa.main_circle_nano1();	else		aa.main_circle_nano2();	_nano_step_=~_nano_step_;	aa.redraw_logs();	aa.check_for_remote_commands();	if (_nano_stepn_++>=GLOBAL_SLEEP_DELAY*10){		time_for_refresh(a);		_nano_stepn_=0;	};	return 1;};int get_mainwin_sizes(GtkWidget *window) {	gint x,y,w,h;	if (FirstConfigureEvent && !CFG.DONOTSET_WINPOS) {		gdk_window_get_root_origin (window->window, &x, &y);		FirstConfigureEvent=0;		if (y!=CFG.WINDOW_Y_POSITION ||		    x!=CFG.WINDOW_X_POSITION){			gdk_window_move(MainWindow->window,					gint(CFG.WINDOW_X_POSITION+(CFG.WINDOW_X_POSITION-x)),					gint(CFG.WINDOW_Y_POSITION+					     (CFG.WINDOW_Y_POSITION-y)));//			FirstConfigureEvent-=1;		};		return FALSE;	};	FirstConfigureEvent=0;	if (window!=NULL && window->window!=NULL &&	    gdk_window_is_visible(window->window)) {//		gdk_window_get_position(window->window,&x,&y);//		gdk_window_get_origin (window->window, &x, &y);		gdk_window_get_root_origin (window->window, &x, &y);//		gdk_window_get_deskrelative_origin(window->window, &x, &y);//		printf("%i %i\n--\n",x,y);		gdk_window_get_size(window->window,&w,&h);		/*		if (CFG.WINDOW_HEIGHT != int(h)){			printf("changed from %i to %i!\n",CFG.WINDOW_HEIGHT,h);		};		*/		CFG.WINDOW_X_POSITION=int(x);		CFG.WINDOW_Y_POSITION=int(y);		CFG.WINDOW_HEIGHT=int(h);		CFG.WINDOW_WIDTH=int(w);	};	return FALSE;};int check_for_clipboard_skiping(char *buf){	char *extension,*temp;	if (CFG.CLIPBOARD_SKIP_OR_CATCH){		extension=new char[strlen(CFG.CATCH_IN_CLIPBOARD)+1];		temp=CFG.CATCH_IN_CLIPBOARD;		do{			temp=extract_string(temp,extension);			if (string_ended_uncase(extension,buf)==0){				delete[] extension;				return 1;			};		}while(temp!=NULL && strlen(temp)>0);		delete[] extension;		return 0;	};	extension=new char[strlen(CFG.SKIP_IN_CLIPBOARD)+1];	temp=CFG.SKIP_IN_CLIPBOARD;	do{		temp=extract_string(temp,extension);		if (string_ended_uncase(extension,buf)==0){			delete[] extension;			return 0;		};	}while(temp!=NULL && strlen(temp)>0);	delete[] extension;	return 1;};void my_get_xselection(GtkWidget *window, GdkEvent *event) {	char *buf;	GdkAtom atom;	gint format, length;	length=gdk_selection_property_get(window->window, (guchar **)&buf, &atom, &format);	if (length) {		if (!equal(buf, OLD_CLIPBOARD_CONTENT)) {			if ((begin_string_uncase(buf,"ftp://") || begin_string_uncase(buf,"http://"))			    && OLD_CLIPBOARD_CONTENT!=NULL && check_for_clipboard_skiping(buf))				init_add_dnd_window(buf,NULL);			if (OLD_CLIPBOARD_CONTENT) g_free(OLD_CLIPBOARD_CONTENT);			OLD_CLIPBOARD_CONTENT = buf;		}else			g_free(buf);	} else {		if (OLD_CLIPBOARD_CONTENT==NULL) OLD_CLIPBOARD_CONTENT=copy_string("");		if (buf) g_free(buf);	}}int time_for_draw_graph(void *a) {/* clipboard monitoring */	if (CFG.CLIPBOARD_MONITOR) {		gtk_selection_convert(MainWindow, GDK_SELECTION_PRIMARY,				      GDK_TARGET_STRING,				      GDK_CURRENT_TIME);	}	return 1;};int time_for_save_list(void *a) {	SAVE_LIST_INTERVAL-=1;	if (!SAVE_LIST_INTERVAL) {		if (CFG.SAVE_LIST) {			save_list();		};		SAVE_LIST_INTERVAL=CFG.SAVE_LIST_INTERVAL;	};	if (CFG.EXIT_COMPLETE && d4x_run_or_wait_downloads()==0){		EXIT_COMPLETE_INTERVAL-=1;		if (EXIT_COMPLETE_INTERVAL<0  &&		    (list_for_adding==NULL || list_for_adding->count()==0)){			my_main_quit();			return 0;		};	}else{		EXIT_COMPLETE_INTERVAL=CFG.EXIT_COMPLETE_TIME;	}	return 1;};void init_timeouts() {	SAVE_LIST_INTERVAL=CFG.SAVE_LIST_INTERVAL;	EXIT_COMPLETE_INTERVAL=CFG.EXIT_COMPLETE_TIME;	ListTimer = gtk_timeout_add (60000, time_for_save_list , NULL);	GraphTimer = gtk_timeout_add (250, time_for_draw_graph , NULL);	LogsTimer = gtk_timeout_add (100, time_for_logs_refresh , NULL);	FirstConfigureEvent=1;	g_signal_connect(G_OBJECT(MainWindow), "configure_event",	                   G_CALLBACK(get_mainwin_sizes),	                   MainWindow);};void main_window_iconify(){	if (MainWindow)		gtk_window_iconify(GTK_WINDOW(MainWindow));};void main_window_popup(){	if (MainWindow)		gtk_window_present(GTK_WINDOW(MainWindow));};void main_window_toggle(){	if (MainWindow){		if (gdk_window_is_visible(MainWindow->window)){			gdk_window_hide(MainWindow->window);		}else{			gtk_window_present(GTK_WINDOW(MainWindow));		};	};};void main_window_resize(int w,int h){	if (MainWindow){		FirstConfigureEvent=0;		w=w<400?400:w;		h=h<200?200:h;		gdk_window_resize(MainWindow->window,w,h);	};};void main_window_move(int x,int y){	if (MainWindow){		FirstConfigureEvent=0;		gdk_window_move(MainWindow->window,x,y);	};};static char *D4X_CLIPBOARD=NULL;char *d4x_mw_clipboard_get(){	if (gdk_selection_owner_get(GDK_SELECTION_PRIMARY)==MainWindow->window){		return(D4X_CLIPBOARD);	};	return(NULL);};void d4x_mw_clipboard_set(char *str){	if (D4X_CLIPBOARD) delete[] D4X_CLIPBOARD;	D4X_CLIPBOARD=copy_string(str);	gtk_selection_owner_set (MainWindow,				 GDK_SELECTION_PRIMARY,				 GDK_CURRENT_TIME);};enum {  TARGET_STRING,  TARGET_TEXT,  TARGET_COMPOUND_TEXT};static void d4x_mw_selection_get (GtkWidget        *widget,				  GtkSelectionData *selection_data,				  guint             info,				  guint             time){	gchar *str;	gint length;		DBC_RETURN_IF_FAIL(widget != NULL);  	if (!D4X_CLIPBOARD) return;	str = copy_string(D4X_CLIPBOARD);	length = strlen (str);	if (info == TARGET_STRING){		gtk_selection_data_set (selection_data,					GDK_SELECTION_TYPE_STRING,					8*sizeof(gchar),					(guchar *)str,					length);	}else{		if ((info == TARGET_TEXT) || (info == TARGET_COMPOUND_TEXT)){			guchar *text;			gchar c;			GdkAtom encoding;			gint format;			gint new_length;						c = str[length];			str[length] = '\0';			gdk_string_to_compound_text (str, &encoding, &format, &text, &new_length);			gtk_selection_data_set (selection_data, encoding, format, text, new_length);			gdk_free_compound_text (text);			str[length] = c;		}	};	g_free (str);}static void d4x_mw_set_targets(){	static const GtkTargetEntry targets[] = {		{ "STRING", 0, TARGET_STRING },		{ "TEXT",   0, TARGET_TEXT }, 		{ "COMPOUND_TEXT", 0, TARGET_COMPOUND_TEXT }	};	static const gint n_targets = sizeof(targets) / sizeof(targets[0]);	gtk_selection_add_targets (MainWindow,				   GDK_SELECTION_PRIMARY,				   targets, n_targets);};void init_face(int argc, char *argv[]) {	gtk_set_locale();	gtk_init(&argc, &argv);	gdk_rgb_init();	d4x_normalize_coords(&(CFG.WINDOW_X_POSITION),&(CFG.WINDOW_Y_POSITION),CFG.WINDOW_WIDTH,CFG.WINDOW_HEIGHT);	MainWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);	gtk_window_set_wmclass(GTK_WINDOW(MainWindow),"D4X_Main", "D4X");	d4x_mw_set_targets();	if (!CFG.DONOTSET_WINPOS){		gtk_window_move(GTK_WINDOW(MainWindow),				gint(CFG.WINDOW_X_POSITION),				gint(CFG.WINDOW_Y_POSITION));	};	gtk_window_set_default_size(GTK_WINDOW(MainWindow),gint(CFG.WINDOW_WIDTH),gint(CFG.WINDOW_HEIGHT));	gtk_window_set_title(GTK_WINDOW (MainWindow), VERSION_NAME);	gtk_widget_set_size_request( GTK_WIDGET (MainWindow), 400, 200);	gtk_widget_realize(MainWindow);	MainWindowGC=gdk_gc_new(MainWindow->window);        dnd_trash_init_menu();	init_main_menu();	init_list_menu();	init_status_bar();	init_buttons_bar();	init_main_window();	init_pixmaps_for_log();/* initing table of shifts */	for (int i=0;i<ROLL_LAST;i++)		ScrollShift[i]=0;#include "pixmaps/main.xpm"	GdkBitmap *bitmap;	GdkPixmap *pixmap=make_pixmap_from_xpm(&bitmap,main_xpm);	gdk_window_set_icon(MainWindow->window,(GdkWindow *)NULL,pixmap,bitmap);	g_signal_connect(G_OBJECT(MainWindow), "delete_event",	                   G_CALLBACK(ask_exit2),	                   NULL);	g_signal_connect(G_OBJECT(MainWindow), "selection_get",			   G_CALLBACK(d4x_mw_selection_get),NULL);	g_signal_connect(G_OBJECT(MainWindow), "selection_received",			   G_CALLBACK(my_get_xselection),NULL);/*	g_signal_connect(G_OBJECT(MainWindow), "selection_clear_event",			   G_CALLBACK(d4x_mw_selection_clear),NULL);*/	g_signal_connect(G_OBJECT (MainWindow),			   "key_press_event",			   G_CALLBACK (main_menu_prepare),			   NULL);	lod_init_pixmaps();	lod_set_height();	if (CFG.DND_TRASH){		dnd_trash_init();		if (CFG.HIDE_MAIN_WINDOW) main_window_toggle();	};	main_log_mask=0;};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -