Ejemplo n.º 1
0
gboolean note_configure_event(GtkWidget *window, GdkEventConfigure *event, Note *note)
{
	note->x = event->x;
	note->y = event->y;
	note->width = event->width;
	note->height = event->height;
	save_note(window, note);
	return FALSE;
}
Ejemplo n.º 2
0
void sync_note_hash(int number)
{
    char *oldstack;
    note *scan,*check;
    int length,count=0,fd,t,tout;
    oldstack=stack;

    if (sys_flags&VERBOSE) {
	sprintf(stack,"Syncing note hash %d.",number);
	stack=end_string(stack);
	log("sync",oldstack);
	stack=oldstack;
    }

    t=time(0);

    for (scan=n_hash[number];scan;scan=check) {
      if (scan->flags&NEWS_ARTICLE) 
      	tout=NEWS_TIMEOUT;
      else
        tout=MAIL_TIMEOUT;
      if ((t-(scan->date))>tout) {
	remove_any_note(scan);
	check=n_hash[number];
      }
      else check=scan->hash_next;
    }

    stack=store_int(stack,0);

    for(scan=n_hash[number];scan;scan=scan->hash_next)
      count+=save_note(scan);

    store_int(oldstack,count);
    length=(int)stack-(int)oldstack;

#ifdef PC
    sprintf(stack,"files\\notes\\hash%d",number);
    fd=open(stack,O_CREAT|O_WRONLY|O_TRUNC|O_BINARY);
#else
    sprintf(stack,"files/notes/hash%d",number);
    fd=open(stack,O_CREAT|O_WRONLY|O_SYNC|O_TRUNC,S_IRUSR|S_IWUSR);
#endif
    if (fd<0) handle_error("Failed to open note file.");
    if (write(fd,oldstack,length)<0)
	handle_error("Failed to write note file.");
    close(fd);

    nhash_update[number]=0;
    stack=oldstack;
}
Ejemplo n.º 3
0
void note_done(void *data, Evas_Object *obj, void *event_info)
{
	char tystr[255];
	//Evas_Object *en = data;
	
	Elm_Object_Item *item = (Elm_Object_Item *)elm_genlist_selected_item_get(list);
	_Task *tsk = (_Task *)elm_object_item_data_get(item);
	sprintf(tystr, "%s", elm_entry_entry_get(data));
	if (strcmp(tystr, "<br>") == 0) strcpy(tystr, "");
	strcpy(tsk->note, tystr);
	save_note(tystr, tsk->no);
	elm_genlist_item_update(item);
	cat_win_del (note_win, NULL, NULL);
}
Ejemplo n.º 4
0
int
bbsmnote_main()
{
	FILE *fp;
	char *ptr, path[256], buf[10000], board[256], notestr[40], buf2[128];
	struct boardmem *x;
	int mode;
	
	html_header(1);
	check_msg();
	printf("<center>\n");
	if (!loginok || isguest)
		http_fatal("´Ò´Ò¹ý¿Í£¬ÇëÏȵǼ");
	changemode(EDIT);
	strsncpy(board, getparm("board"), 30);
	x = getboard(board);
	mode = atoi(getparm("mode"));
	if (!has_BM_perm(&currentuser, x))
		http_fatal("ÄãÎÞȨ½øÐб¾²Ù×÷");
	switch (mode) {
	case 1:
		sprintf(path, "vote/%s/notes", board);
		sprintf(notestr, "Ò»°ã±¸Íü¼");
		break;
	case 2:
		sprintf(path, "vote/%s/secnotes", board);
		sprintf(notestr, "ÃØÃܱ¸Íü¼");
		break;
	case 3:
	default:
		setbfile(path, board, "introduction");
		sprintf(notestr, "°æÃæ¼ò½é");
		break;
	}
	if (!strcasecmp(getparm("type"), "update")){
		if (mode == 2){
			sprintf(buf2, "vote/%s/notespasswd", board);
			unlink(buf2);
		}
		save_note(path);
	}
	printf("%s -- ±à¼­%s [ÌÖÂÛÇø: %s]<hr>\n", BBSNAME, notestr, board);
	printf
	    ("<form name=form1 method=post action=bbsmnote?type=update&board=%s&mode=%d>\n",
	     board, mode);
	fp = fopen(path, "r");
	if (fp) {
		fread(buf, 9999, 1, fp);
		ptr = strcasestr(buf, "<textarea>");
		if (ptr)
			ptr[0] = 0;
		fclose(fp);
	}
	printf("<table border=1><tr><td>");
	printf
	    ("<textarea  onkeydown='if(event.keyCode==87 && event.ctrlKey) {document.form1.submit(); return false;}'  onkeypress='if(event.keyCode==10) return document.form1.submit()' name=text rows=20 cols=80 wrap=virtual>\n");
	printf("%s", nohtml(void1(buf)));
	printf("</textarea></table>\n");
	printf("<input type=submit value=´æÅÌ> ");
	printf("<input type=reset value=¸´Ô­>\n");
	printf("<hr>\n");
	http_quit();
	return 0;
}
Ejemplo n.º 5
0
/*
 * Complete the reading of the status byte. The parsed midi
 * command will be added to the specified track .
 * 
 *  Arguments:
 *    msp       - Current midi file status
 *    track     - Current track
 *    status    - Status byte, ie. current command
 */
static void 
handle_status(struct midistate *msp, struct trackElement *track, int status)
{
	int  ch;
	int  type;
	int  device;
	int  length;
	short note, vel, control;
	int  val;
	unsigned char *data;
	struct element *el;

	ch = status & 0x0f;
	type = status & 0xf0;

	/*
	 * Do not set the device if the type is 0xf0 as these commands are
	 * not channel specific
	 */
	device = 0;
	if (type != 0xf0)
		device = (msp->port<<4) + ch;
	msp->device = device;

	el = NULL;

	switch (type) {	
	case MIDI_NOTE_OFF:
		note = read_int(msp, 1);
		vel = read_int(msp, 1);

		finish_note(msp, note, vel);
		break;

	case MIDI_NOTE_ON:
		note = read_int(msp, 1);
		vel = read_int(msp, 1);

		if (vel == 0) {
			/* This is really a note off */
			finish_note(msp, note, vel);
		} else {
			/* Save the start, so it can be matched with the note off */
			el = save_note(msp, note, vel);
		}
		break;

	case MIDI_KEY_AFTERTOUCH:
		note = read_int(msp, 1);
		vel = read_int(msp, 1);

		/* new aftertouchElement */
		el = MD_ELEMENT(md_keytouch_new(note, vel));
		break;

	case MIDI_CONTROLER:
		control = read_int(msp, 1);
		val = read_int(msp, 1);
		el = MD_ELEMENT(md_control_new(control, val));

		break;
	
	case MIDI_PATCH:
		val = read_int(msp, 1);
		el = MD_ELEMENT(md_program_new(val));
		break;

	case MIDI_CHANNEL_AFTERTOUCH:
		val = read_int(msp, 1);
		el = MD_ELEMENT(md_pressure_new(val));
		break;
	case MIDI_PITCH_WHEEL:
    {
		val = read_int(msp, 1);
        int val2 = read_int(msp, 1);
		val |=  val2 << 7;
		val -= 0x2000;	/* Center it around zero */
		el = MD_ELEMENT(md_pitch_new(val));
		break;
    }
	/* Now for all the non-channel specific ones */
	case 0xf0:
		/* Deal with the end of track event first */
		if (ch == 0x0f) {
			type = read_int(msp, 1);
			if (type == 0x2f) {
				/* End of track - skip to end of real track */
				track->final_time = msp->current_time;
				skip_chunk(msp);
				return;
			}
		}

		/* Get the length of the following data */
		length = read_var(msp);
		data = read_data(msp, length);
		if (ch == 0x0f) {
			el = (struct element *)handle_meta(msp, type, data);
		} else {
			el = (struct element *)md_sysex_new(status, data, length);
		}
		break;
	default:
		except(formatError, "Bad status type 0x%x", type);
		/*NOTREACHED*/
	}

	if (el != NULL) {
		el->element_time = msp->current_time;
		el->device_channel = device;

		md_add(MD_CONTAINER(track), el);
	}
}
Ejemplo n.º 6
0
void set_current_note_color(GtkMenuItem *menuitem, ColorScheme *scheme)
{
	set_note_color(current_note, scheme);
	save_note(NULL, current_note);
}