Example #1
0
static void
open_windows (NautilusApplication *application,
	      gboolean force_new,
	      GFile **files,
	      gint n_files,
	      GdkScreen *screen,
	      const char *geometry)
{
	guint i;

	if (files == NULL || files[0] == NULL) {
		/* Open a window pointing at the default location. */
		open_window (application, NULL, screen, geometry);
	} else {
		/* Open windows at each requested location. */
		for (i = 0; i < n_files; ++i) {
			NautilusWindowSlot *slot = NULL;

			if (!force_new)
				slot = get_window_slot_for_location (application, files[i]);

			if (!slot) {
				open_window (application, files[i], screen, geometry);
			} else {
				/* We open the location again to update any possible selection */
				nautilus_window_slot_open_location (slot, files[i], 0);

				NautilusWindow *window = nautilus_window_slot_get_window (slot);
				nautilus_window_set_active_slot (window, slot);
				gtk_window_present (GTK_WINDOW (window));
			}
		}
	}
}
Example #2
0
int main(int argc, char** argv)
{
    int x, y, width;
    GLuint texture;

    glfwSetErrorCallback(error_callback, NULL);

    if (!glfwInit())
        exit(EXIT_FAILURE);

    windows[0] = open_window("First", NULL, OFFSET, OFFSET);
    if (!windows[0])
    {
        glfwTerminate();
        exit(EXIT_FAILURE);
    }

    // This is the one and only time we create a texture
    // It is created inside the first context, created above
    // It will then be shared with the second context, created below
    texture = create_texture();

    glfwGetWindowPos(windows[0], &x, &y);
    glfwGetWindowSize(windows[0], &width, NULL);

    // Put the second window to the right of the first one
    windows[1] = open_window("Second", windows[0], x + width + OFFSET, y);
    if (!windows[1])
    {
        glfwTerminate();
        exit(EXIT_FAILURE);
    }

    // Set drawing color for both contexts
    glfwMakeContextCurrent(windows[0]);
    glColor3f(0.6f, 0.f, 0.6f);
    glfwMakeContextCurrent(windows[1]);
    glColor3f(0.6f, 0.6f, 0.f);

    glfwMakeContextCurrent(windows[0]);

    while (!glfwWindowShouldClose(windows[0]) &&
           !glfwWindowShouldClose(windows[1]))
    {
        glfwMakeContextCurrent(windows[0]);
        draw_quad(texture);

        glfwMakeContextCurrent(windows[1]);
        draw_quad(texture);

        glfwSwapBuffers(windows[0]);
        glfwSwapBuffers(windows[1]);

        glfwWaitEvents();
    }

    glfwTerminate();
    exit(EXIT_SUCCESS);
}
Example #3
0
/* acc_open()
 * =====================================================================
 * Accessory Open Messages
 * 
 * IN: int *msg: message buffer;
 * OUT: void
 *
 * GLOBAL: WINFO w:   window structure
 *         int   ctrl_id: application id
 */
void
acc_open( const int *msg )
{
    if( msg[4] == ctrl_id )
    {
      if( w.id == NO_WINDOW )
      {
        if( xres >= MIN_RESOLUTION )
	{
          if( Create_Window() )
          {
            ActiveTree( ad_front );
            initialize();
            open_window();
            Activity();
          }
          else
            form_alert( 1, alert13 );
	}
	else
            form_alert( 1, wider );
      }
      else
        wind_set( w.id, WF_TOP );
    }
}
Example #4
0
int main(void)
{
    if (!glfwInit())
    {
        fprintf(stderr, "Failed to initialize GLFW\n");
        exit(EXIT_FAILURE);
    }

    if (!open_window())
    {
        fprintf(stderr, "Failed to open GLFW window\n");
        exit(EXIT_FAILURE);
    }

    glClearColor(0.f, 0.f, 0.f, 0.f);

    while (glfwGetWindowParam(GLFW_OPENED))
    {
        glClear(GL_COLOR_BUFFER_BIT);

        glfwSwapBuffers();
        glfwWaitEvents();
    }

    glfwTerminate();
    exit(EXIT_SUCCESS);
}
Example #5
0
bool application::init()
{
	if (_initialized)
		return true;

	_config = load_config();

	// NOTE(Corralx): If something fails, everything else after will fail too, but that's not a problem
	bool ret = open_window();
	assert(ret);

	ret &= initialize_opengl();
	assert(ret);

	ret &= create_opengl_resources();
	assert(ret);

	ret &= imgui_init(_window);
	assert(ret);

	if (!ret)
	{
		cleanup();
		return false;
	}

	_initialized = true;
	return true;
}
Example #6
0
void init_newrun_window_for_new_run(GtkWidget *widget, gpointer data)
{
        NEW_DATA *new_data = (NEW_DATA *) data;
        new_data->edit_index = -1;
        populate_MRUs(new_data);

        // keep deault date (today)
        set_date_calendar(GTK_CALENDAR(new_data->calendar), (gpointer) new_data);

        // setting the distance to 0
        gtk_spin_button_set_value(GTK_SPIN_BUTTON(new_data->distance_chooser), 0);

        // setting the time fields to 0
        gtk_entry_buffer_set_text(new_data->seconds_buff, "00", 2);
        gtk_entry_buffer_set_text(new_data->minutes_buff, "00", 2);
        gtk_entry_buffer_set_text(new_data->hours_buff, "00", 2); 

        printf("setting combobox to nothing!!\n");
        GtkWidget *entry = gtk_bin_get_child(GTK_BIN(new_data->route_entry));
        gtk_entry_set_text(GTK_ENTRY(entry), "");
        entry = gtk_bin_get_child(GTK_BIN(new_data->workout_type_entry));
        gtk_entry_set_text(GTK_ENTRY(entry), "");

        // setting the feel3 button active 
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(new_data->feel3), true);

        // setting the morning button active
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(new_data->time1), true);
        
        //clearing the notes buffer
        gtk_text_buffer_set_text(new_data->notes_buff, "\0", -1);

        open_window(GTK_WIDGET(widget), (gpointer) new_data->newrun_window);

}
Example #7
0
/* wind_init()
 * =====================================================================
 * Initialize window structure.
 */
void
wind_init( void )
{
   if(( AES_Version >= 0x0330 )
        && ( gl_ncolors > LWHITE ) )
   {
     Do3D();
   }

   init_window();
   
   if( _app )
   {
      if( xres >= MIN_RESOLUTION )
      {
        if( Create_Window() )
        {
          ActiveTree( ad_front );
          initialize();
          open_window();
          graf_mouse( ARROW, 0L );
          Activity();
        }
        else
          form_alert( 1, alert13 );
      }
      else
      {
	  form_alert( 1, wider );
	  gem_exit( 0 );
      }
   }
}
Example #8
0
void xapi_set_videomode(void *d) {
	int vmode; 
	if (getvidmode() !=0) {
		remote_printf(413, "cannot change videomode while window is open.");
		return;
	}
	vmode=parsevidoutname(d);
	if (vmode==0 ) vmode = atoi((char*)d);
	if (vmode <0) {
		remote_printf(414, "video mode needs to be a positive integer or 0 for autodetect.");
		return;
	}
	render_fmt = vidoutmode(vmode);
	remote_printf(100, "setting video mode to %i",getvidmode());

	open_window(); // required here; else VOutout callback fn will fail.

	if (pFrameFMT && current_file) { 
		// reinit buffer with new format
		char *fn=strdup(current_file);
		open_movie(fn);
		free(fn);
	} else {
		if(buffer) free(buffer); buffer=NULL;
		// set videomode to 0 or loop_flag=0?
	}
	init_moviebuffer();
	force_redraw=1;
}
Example #9
0
/*! event in main menu */
void event_pmenu(int *quit) {
	int i;

	switch(buf[4]) 	{
	case M_ALERTE :
		big_alert(2, ALERT, "", TRUE);
		menu_tnormal(adr_menu, T_FICHIER, 1);
		break;
	
	case M_WMENU :
		win[WINDMENU].w_pal =(Palette *)malloc(work_display.n_color *sizeof(Palette));
		for(i = 0 ; i < work_display.n_color ; i++) {
			win[WINDMENU].w_pal[i][0] = work_display.palette[i][0];
			win[WINDMENU].w_pal[i][1] = work_display.palette[i][1];
			win[WINDMENU].w_pal[i][2] = work_display.palette[i][2];
		}
		open_window(WINDMENU, WTYP_PICT, WATR_CURRB,
			bureau.xd +(bureau.wd / 5), bureau.yd +(bureau.hd / 5), 320, 150,
			100, 100, 200, 200, 16, 16,
			WFARROW, THIN_CROSS,
			winicn, ZERO, close_wmenu, get_string(TIT_MENU), "",
			(long) bureau.wd,(long) bureau.hd, TRUE, FALSE, W_MENU,
			10, BLACK);
		menu_tnormal(adr_menu, T_FENETRES, 1);
		break;
	
	case M_QUITTER :
		*quit = TRUE;
		menu_tnormal(adr_menu, T_FICHIER, 1);
		break;
	}	/* switch case */
}	/* endof event_pmenu */
Example #10
0
int
init_top_window(char *name)
{
    HyperDocPage *page;
    XSetWindowAttributes wa;    /* The X attributes structure */
    HDWindow *old_win = gWindow;

    gWindow = alloc_hd_window();

    if (name == NULL) {
        /** Then allocate an empty page, and assign it to gWindow->page */
        page = alloc_page((char *) NULL);
    }
    else {
        /* Try to find the page in the page hash table */
        page = (HyperDocPage *) hash_find(gWindow->fPageHashTable, name);
        if (page == NULL) {
            fprintf(stderr, "(HyperDoc)  Couldn\'t find page %s in page hash table \n",
                    name);
            if (gParentWindow == NULL)
                /* Gaak, This is a start up error */
                exit(-1);
            else {
                gWindow = old_win;
                return -1;
            }
        }
    }

    /* First allocate memory for the new window structure   */
    gWindow->page = page;

    if (old_win == NULL)
        open_window(0);
    else
        open_window(old_win->fMainWindow);

    get_GCs(gWindow);
    XMapWindow(gXDisplay, gWindow->fMainWindow);
    hash_insert(&gSessionHashTable, (char *)gWindow,(char *) &gWindow->fMainWindow);

    change_text(gRmColor, gRmFont);
    wa.background_pixel = gBackgroundColor;
    XChangeWindowAttributes(gXDisplay, gWindow->fMainWindow, CWBackPixel, &wa);
    XChangeWindowAttributes(gXDisplay, gWindow->fScrollWindow, CWBackPixel,&wa);
    return 1;
}
Example #11
0
XWindowObject::XWindowObject(std::string name, std::shared_ptr<XDisplayBase> disp_base, unsigned int width, unsigned int height, unsigned int n_contexts)
  : display_base(disp_base), height_(height), width_(width)
{
#ifdef DEBUG
  std::cout << "[XWindowObject::XWindowObject]" << std::endl;
#endif // DEBUG
  open_window(name, n_contexts);
  XFlush(display_base->xDisplay);
}
Example #12
0
/*! free popup event */
void event_freepu(void) {
	int i;

	switch(buf[4]) {
	case PUL_ALERT :
		if(_app) 
			menu_tnormal(adr_menu, T_FICHIER, 0);
		else {
			win[WINDACC].w_bar[T_FICHIER + 3].ob_state |= SELECTED;
			draw_object(T_FICHIER + 3, WINDACC);
		}
		big_alert(2, ALERT, "", TRUE);

		if(_app)
			menu_tnormal(adr_menu, T_FICHIER, 1);
		else {
			win[WINDACC].w_bar[T_FICHIER + 3].ob_state &= ~SELECTED;
			draw_object(T_FICHIER + 3, WINDACC);
		}
		break;
	
	case PUL_WMENU :
		if(_app)
			menu_tnormal(adr_menu, T_FENETRES, 0);
		else {
			win[WINDACC].w_bar[T_FENETRES + 3].ob_state |= SELECTED;
			draw_object(T_FENETRES + 3, WINDACC);
		}
		if(win[WINDMENU].w_hg <= ZERO) {
			win[WINDMENU].w_pal =(Palette *)malloc(work_display.n_color * sizeof(Palette));
			for(i = 0 ; i < work_display.n_color ; i++) {
				win[WINDMENU].w_pal[i][0] = work_display.palette[i][0];
				win[WINDMENU].w_pal[i][1] = work_display.palette[i][1];
				win[WINDMENU].w_pal[i][2] = work_display.palette[i][2];
			}
			open_window(WINDMENU, WTYP_PICT, WATR_CURRB,
				bureau.xd +(bureau.wd / 5), bureau.yd +(bureau.hd / 5), 320, 150,
				100, 100, 200, 200, 16, 16,
				WFARROW, THIN_CROSS,
				winicn, ZERO, close_wmenu, get_string(TIT_MENU), "",
				(long) bureau.wd,(long) bureau.hd,
				TRUE, FALSE, W_MENU,
				10, BLACK);
		}
		else {
			buf[3] = win[WINDMENU].w_hg;
			(*win[WINDMENU].w_top)();
		}
		if(_app)
			menu_tnormal(adr_menu, T_FENETRES, 1);
		else {
			win[WINDACC].w_bar[T_FENETRES + 3].ob_state &= ~SELECTED;
			draw_object(T_FENETRES + 3, WINDACC);
		}
		break;
	}	/* end switch case */
}	/* event_freepu */
int main(int argc, char** argv)
{
    int count = 0;

    if (!glfwInit())
    {
        fprintf(stderr, "Failed to initialize GLFW\n");
        exit(1);
    }

    for (;;)
    {
        if (!open_window(640, 480, (count & 1) ? GLFW_FULLSCREEN : GLFW_WINDOW))
        {
            glfwTerminate();
            exit(1);
        }

        glMatrixMode(GL_PROJECTION);
        glOrtho(-1.f, 1.f, -1.f, 1.f, 1.f, -1.f);
        glMatrixMode(GL_MODELVIEW);

        glClearColor(0.f, 0.f, 0.f, 0.f);
        glColor3f(1.f, 1.f, 1.f);

        glfwSetTime(0.0);

        while (glfwGetTime() < 5.0)
        {
            glClear(GL_COLOR_BUFFER_BIT);

            glPushMatrix();
            glRotatef((GLfloat) glfwGetTime() * 100.f, 0.f, 0.f, 1.f);
            glRectf(-0.5f, -0.5f, 1.f, 1.f);
            glPopMatrix();

            glfwSwapBuffers();

            if (closed)
                close_window();

            if (!glfwGetWindowParam(GLFW_OPENED))
            {
                printf("User closed window\n");

                glfwTerminate();
                exit(0);
            }
        }

        printf("Closing window\n");
        close_window();

        count++;
    }
}
Example #14
0
static void
open_windows (NemoMainApplication *application,
	      GFile **files,
	      gint n_files,
	      GdkScreen *screen,
	      const char *geometry)
{
	gint i;

	if (files == NULL || files[0] == NULL) {
		/* Open a window pointing at the default location. */
		open_window (application, NULL, screen, geometry);
	} else {
		/* Open windows at each requested location. */
		for (i = 0; i < n_files; i++) {
			open_window (application, files[i], screen, geometry);
		}
	}
}
Example #15
0
/*! loads ASCII text in  window */
void charge_texte(void) {
	char chemin[125], fname[13] = "", fichier[125], *selec, *ptr;
	long longueur;
	int fh, count = 1, dummy, w_cell, h_cell;

	if(win[TEXTE].w_icon > BLANK)
		return;

	if((fgdos) &&(fid != 1)) {	
		/* take size of character box */
		vst_font(work_display.handle, fid);
		vst_arbpt(work_display.handle, size, &dummy, &dummy, &dummy, &h_cell);
		vst_setsize(work_display.handle, size, &dummy, &dummy, &w_cell, &dummy);
	}
	
	else
		vst_height(work_display.handle, size, &dummy, &dummy, &w_cell, &h_cell);
	strcpy(chemin, pathapp);					/* Chemin de l'application */
	selec = get_string(CHARGETXT);		/* Récupérer message sélecteur */
	if(selector(chemin, "\*.TXT", fname, selec) == TRUE && strlen(fname)) {	
		/* if file selected */
		strcpy(fichier, chemin);
		strcat(fichier, fname);					/* recreate access path */
		longueur = exist(fichier, ZERO);
		if(longueur) {							/* if exist */
			if(win[TEXTE].w_cont.w_adr)
				free(win[TEXTE].w_cont.w_adr);	/* Libérer le précédent s'il y en a */
			win[TEXTE].w_cont.w_adr =(char *)malloc(longueur);	/* Réserver mémoire */
			if(win[TEXTE].w_cont.w_adr) {
				fh =(int)Fopen(fichier, FO_READ);	/* open file */
				Fread(fh, longueur, win[TEXTE].w_cont.w_adr);	/* load */
				Fclose(fh);							/* close file */

				for(ptr = win[TEXTE].w_cont.w_adr ; 
						ptr < win[TEXTE].w_cont.w_adr + longueur ; ptr++) {
					if(*ptr == '\r') {
						*ptr = '\0';
						count++;
					}
				}
				open_window(TEXTE, WTYP_NORM, WATR_CURRB,
					bureau.xd + 10, bureau.yd +(bureau.hd / 4), bureau.wd - 20, 
					bureau.hd / 2,
					100, 100, BLANK, BLANK, w_cell, h_cell,
					(WFARROW|WFGROUP), TEXT_CRSR,
					winicn, aff_texte, close_txt, get_string(TIT_TXT), "",
					(long)((long) MAX_LEN *(long) w_cell),
					(long)((long) count *(long) h_cell),
					FALSE, TRUE, TOOL, ZERO, WHITE);
			}
		}
	}
Example #16
0
File: peter.c Project: arsenm/glfw
int main(void)
{
    glfwSetErrorCallback(error_callback);

    if (!glfwInit())
        exit(EXIT_FAILURE);

    if (!open_window())
    {
        glfwTerminate();
        exit(EXIT_FAILURE);
    }

    glClearColor(0.f, 0.f, 0.f, 0.f);

    while (!glfwGetWindowParam(window_handle, GLFW_SHOULD_CLOSE))
    {
        glClear(GL_COLOR_BUFFER_BIT);

        glfwSwapBuffers(window_handle);
        glfwWaitEvents();

        if (reopen)
        {
            glfwDestroyWindow(window_handle);
            if (!open_window())
            {
                glfwTerminate();
                exit(EXIT_FAILURE);
            }

            reopen = GL_FALSE;
        }
    }

    glfwTerminate();
    exit(EXIT_SUCCESS);
}
static int open_TraceWin()
		/*success-> return 0;*/
{
	int		i;

	open_window(&win, kTraceWinID);
	position_window(&win);
	
	mac_ctl_reset_trc();
	for(i = 0; i < 16; i++)
	    init_bitset(channel_program_flags + i, 128);

	return 0;
}
// init ... open a window and set initial default values
int OpenGLDisplayDevice::init(int argc, char **argv, VMDApp *app, int *size, int *loc) {
  vmdapp = app; // save VMDApp handle for use by drag-and-drop handlers

  // open the window
  if (open_window(name, size, loc, argc, argv) != 0) return FALSE;
  if (!have_window) return FALSE;

  // get screen size 
  // XXX There's no Win32 API to get the full multi-monitor desktop,
  //     so this code doesn't correctly handle multi-monitor systems yet.
  //     To correctly handle multiple monitors, we'd have to 
  //     walk the device tree, take into account monitor layout/positioning, 
  //     and compute the desktop dimensions from that.  Since these values
  //     are currently only used by do_reposition_window() method, we can
  //     live with primary-monitor values for the time being.
  screenX = GetSystemMetrics(SM_CXSCREEN);
  screenY = GetSystemMetrics(SM_CYSCREEN);

  // set flags for the capabilities of this display
  ext->hasmultisample = FALSE;      // no code for this extension yet
  ext->nummultisamples = 0;
  aaAvailable = FALSE;

  // set default settings
  if (ext->hasmultisample) {
    aa_on();  // enable fast multisample based antialiasing by default
              // other antialiasing techniques are slow, so only multisample
              // makes sense to enable by default.
  }

  cueingAvailable = TRUE;
  cueing_on(); // leave depth cueing on by default, despite the speed hit.

  cullingAvailable = TRUE;
  culling_off();

  set_sphere_mode(sphereMode);
  set_sphere_res(sphereRes);
  set_line_width(lineWidth);
  set_line_style(lineStyle);

  // reshape and clear the display, which initializes some other variables
  reshape();
  normal();
  clear();
  update();

  // successfully created window
  return TRUE;
}
Example #19
0
static int open_SpecWin()
		/*success-> return 0;*/
{
#ifdef SUPPORT_SOUNDSPEC
	open_window(&win, kSpecWinID);
	position_window(&win);
	
	//always 
	//if( win.show ){ //Preference on
		open_soundspec();
	   	soundspec_update_wave(NULL, 0);
	//}
#endif /* SUPPORT_SOUNDSPEC */
	return 0;
}
Example #20
0
static int open_LogWin()
		/*success-> return 0;*/
{
	open_window(&win, kLogWinID);
	position_window(&win);
	setsize_window(&win);
	
	SetPortWindowPort(win.ref);
	TextSize(10);
	gLogTE=TENew(&win.ref->portRect, &win.ref->portRect);
	if( gLogTE==0 ) mac_ErrorExit("\ppCannot open LogWindow!");
	
	TEFeatureFlag(teFAutoScroll, teBitSet, gLogTE);
	TEActivate(gLogTE);
	return 0;
}
Example #21
0
int main(int argc, char** argv)
{
    int count = 0;

    for (;;)
    {
        if (!open_window(640, 480, (count & 1) ? GLFW_FULLSCREEN : GLFW_WINDOWED))
        {
            glfwTerminate();
            exit(EXIT_FAILURE);
        }

        glMatrixMode(GL_PROJECTION);
        glOrtho(-1.f, 1.f, -1.f, 1.f, 1.f, -1.f);
        glMatrixMode(GL_MODELVIEW);

        glfwSetTime(0.0);

        while (glfwGetTime() < 5.0)
        {
            glClear(GL_COLOR_BUFFER_BIT);

            glPushMatrix();
            glRotatef((GLfloat) glfwGetTime() * 100.f, 0.f, 0.f, 1.f);
            glRectf(-0.5f, -0.5f, 1.f, 1.f);
            glPopMatrix();

            glfwSwapBuffers(window_handle);
            glfwPollEvents();

            if (closed)
            {
                close_window();
                printf("User closed window\n");

                glfwTerminate();
                exit(EXIT_SUCCESS);
            }
        }

        printf("Closing window\n");
        close_window();

        count++;
    }
}
Example #22
0
static int open_PlayerWin()
		/*success-> return 0;*/
{
	int	i;
	OSErr	err;
	RGBColor	back={0,0,0},
				fore={65535,65535,65535};
	
	open_window( &win, kPlayerWinID);
	position_window(&win);
	
	SetPortWindowPort(win.ref);
	RGBForeColor(&fore);
	RGBBackColor(&back);
	logo= GetPicture(128);
	logoDown= GetPicture(132);
	
	for(i=0; i<6; i++)
		button[i]= GetCIcon(i+200);
	iconPlay=GetCIcon(210);
	iconPause=GetCIcon(211);
	iconVol=GetCIcon(206);
	iconTab=GetCIcon(207);
	iconNotLoop=GetCIcon(208);
	iconLoop=GetCIcon(209);
	
	if(gHasDragMgr)
	{
		receiveRgn=NewRgn();
		if( receiveRgn )
		{
			GetWindowContentRgn(win.ref, receiveRgn);
			err=InstallTrackingHandler(NewDragTrackingHandlerProc(DragTrackingProc),
								(WindowPtr)win.ref, 0);
			if(err) ExitToShell();
			
			err=InstallReceiveHandler(NewDragReceiveHandlerProc(DragReceiveFunc),
							(WindowPtr)win.ref, 0);
			if(err) ExitToShell();
		}
	}
	return 0;
}
Example #23
0
static int open_ListWin()
		/*success-> return 0;*/
{
	Rect		listRect, dataBounds;
	Point		cSize;

	open_window(&win, kListWinID);
	position_window(&win);
	setsize_window(&win);
	
	SetPortWindowPort(win.ref);
	TextSize(10);
	listRect=win.ref->portRect;	listRect.right-=14; listRect.bottom-=14;
	dataBounds.top=dataBounds.left=0; dataBounds.right=1; dataBounds.bottom=0;
	cSize.h=1024; cSize.v=14;
	gPlaylist = LNew(&listRect, &dataBounds, cSize, 0, win.ref, 
						1, 1, 0, 1);
	return 0;
}
Example #24
0
static int open_DocWin()
		/*success-> return 0;*/
{
	Rect	r;

	open_window(&win, kDocWinID);
	position_window(&win);
	setsize_window(&win);
	
	SetPortWindowPort(win.ref);
	TextSize(10);
	r=win.ref->portRect; r.right-=16;
	gDocTE=TENew(&r, &r);
	if( gDocTE==0 ) mac_ErrorExit("\pCannot open DocWindow!");
	
	TEFeatureFlag(teFAutoScroll, teBitSet, gDocTE);
	TEActivate(gDocTE);
	return 0;
}
int OpenGLPbufferDisplayDevice::init(int argc, char **argv, VMDApp *app, int *size, int *loc) {
  vmdapp = app; // save VMDApp handle for use by drag-and-drop handlers
                // and GPU memory management routines

  // open the window
  glxsrv.windowID = open_window(name, size, loc, argc, argv);
  if (!have_window) return FALSE;

  // set flags for the capabilities of this display
  // whether we can do antialiasing or not.
  if (ext->hasmultisample) 
    aaAvailable = TRUE;  // we use multisampling over other methods
  else
    aaAvailable = FALSE; // no non-multisample implementation yet

  // set default settings
  if (ext->hasmultisample) {
    aa_on();  // enable fast multisample based antialiasing by default
              // other antialiasing techniques are slow, so only multisample
              // makes sense to enable by default.
  } 

  cueingAvailable = TRUE;
  cueing_on(); // leave depth cueing on by default, despite the speed hit.

  cullingAvailable = TRUE;
  culling_off();

  set_sphere_mode(sphereMode);
  set_sphere_res(sphereRes);
  set_line_width(lineWidth);
  set_line_style(lineStyle);

  // reshape and clear the display, which initializes some other variables
  reshape();
  normal();
  clear();
  update();

  // We have a window, return success.
  return TRUE;
}
Example #26
0
/*************************************************************************
 *
 *N  info_window
 *
 *::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 *
 *   Purpose:
 *P
 *     This function displays a temporary window to the screen with a
 *     single string of text.  Must be in graphics mode to call this
 *     function.
 *E
 *::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 *
 *   Parameters:
 *A
 *    text    <input> == (char *)message to display.
 *    return <output> == (window_type) window created and displayed.
 *                       [Will need to be deleted]
 *E
 *::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 *
 *   History:
 *H
 *    Barry Michaels   July 1990   Original Version   DOS Turbo C
 *E
 *************************************************************************/
window_type info_window( char *text )
{
   window_type w;
   int x,y;

   settextstyle(SMALL_FONT,HORIZ_DIR,4);
   settextjustify(LEFT_TEXT,BOTTOM_TEXT);
   if (textwidth(text) > getmaxx())
     x = getmaxx()-20;
    else
     x = textwidth(text) + 20;
   create_window( &w, x, textheight(text)+10,
		  menucolor,menubordercolor );
   get_display_position( &x, &y, w );
   open_window( &w, x,y );
   setcolor(menutextcolor);
   hidemousecursor();
   outtextxy( 10,textheight(text)+5,text );
   showmousecursor();
   return w;
}
int OpenGLDisplayDevice::init(int argc, char **argv, VMDApp* app, int *size, int *loc) {

  // open the window
  sdlsrv.windowID = open_window(name, size, loc, argc, argv);
  if (!have_window) return FALSE;

  // set flags for the capabilities of this display
  // whether we can do antialiasing or not.
  if (ext->hasmultisample) 
    aaAvailable = TRUE;  // we use multisampling over other methods
  else
    aaAvailable = FALSE; // no non-multisample implementation yet

  cueingAvailable = TRUE;
  cullingAvailable = TRUE;
  cullingEnabled = FALSE;

  // set default settings
  if (ext->hasmultisample) {
    aa_on();  // enable fast multisample based antialiasing by default
              // other antialiasing techniques are slow, so only multisample
              // makes sense to enable by default.
  } 
  cueing_off(); // leave depth cueing off by default, since its a speed hit.

  set_sphere_mode(sphereMode);
  set_sphere_res(sphereRes);
  set_line_width(lineWidth);
  set_line_style(lineStyle);

  // reshape and clear the display, which initializes some other variables
  reshape();
  normal();
  clear();
  update();

  // successfully opened window.
  return TRUE;
}
Example #28
0
/* -------------------------
	 | Dialog window handler |
	 ------------------------- */
int dialog_window(int wind_id, OBJECT *dialog, int action, int ext)
{
    int x, y, w, h, s;
    int w_x, w_y, w_w, w_h;
    int hndl, sel;

    switch(action)
    {
    case CLS_DIA:
        wind_close(wind_id);
        wind_delete(wind_id);
        break;

    case OPN_DIA:
        form_center(dialog, &x, &y, &w, &h);
        wind_calc(WC_BORDER, MOVER|NAME, x, y, w, h, &w_x, &w_y, &w_w, &w_h);
        hndl = open_window(MOVER|NAME, w_x, w_y, w_w, w_h, "");
        return hndl;

    case RDW_DIA:
        s = first_rect(wind_id, 0);
        while(s)
        {
            objc_draw(dialog, ext, MAX_DEPTH, r_xy[0], r_xy[1], r_xy[2], r_xy[3]);
            s = next_rect(wind_id, 0);
        }
        break;

    case ACT_DIA:
        sel = win_formdo(dialog, ext, wind_id);
        if (dialog[sel].ob_flags & EXIT)
            dialog[sel].ob_state &= ~SELECTED;

        return sel;
    }
    return 0;
}
Example #29
0
static void GLFWCALL key_callback(int key, int action)
{
    switch (key)
    {
        case GLFW_KEY_SPACE:
        {
            if (action == GLFW_PRESS)
                toggle_mouse_cursor();

            break;
        }

        case 'R':
        {
            if (action == GLFW_PRESS)
            {
                glfwCloseWindow();
                open_window();
            }

            break;
        }
    }
}
Example #30
0
/****************************************************************
*																*
*					ouvre la fenˆtre du tampon					*
*																*
****************************************************************/
void ouvrir_tampon(void)
{
	windowptr thewin = Tampon;
	WIN *win;
	GRECT rect;
	t_win_coord *window;
	int dummy;

	/* demande la taille de la fenˆtre */
	window = get_info(1, Tampon, &rect);

	thewin -> fonction.secteur.couleur_curseur = window -> fonction.texte.curseur_c;
	thewin -> fonction.secteur.trame_curseur = window -> fonction.texte.curseur_t;
	thewin -> fonction.text.couleur_texte = window -> fonction.texte.texte_c;
	thewin -> fonction.text.taille_pt = window -> fonction.texte.texte_pt;
	thewin -> fonction.text.couleur_fond = window -> fonction.texte.background_c;
	thewin -> fonction.text.trame_fond = window -> fonction.texte.background_t;

	/* Create the information for the window.  Max size is the desktop. */
	win = open_window(thewin -> title, thewin -> title, NULL, NULL, window -> type, TRUE, 10, 10, &desk, &rect, NULL, secteurproc, NULL, 0);

	/* Check for error. */
	if (win == NULL)
	{
		error_msg(Z_NO_MORE_WINDOW);
		return;
	}

	if (!open_work(&win -> vdi_handle, work_out))
	{
		my_alert(1, FAIL, X_ICN_STOP, Messages(MAIN_9), NULL);
		close_window(win, FALSE);
		return;
	}

	thewin -> win = win;

	vst_point(win -> vdi_handle, thewin -> fonction.text.taille_pt, &dummy, &dummy, &thewin -> fonction.text.taille_w, &thewin -> fonction.text.taille_h);
	vst_color(win -> vdi_handle, thewin -> fonction.secteur.couleur_texte);
	vsf_interior(win -> vdi_handle, FIS_SOLID);
	vswr_mode(win -> vdi_handle, MD_REPLACE);
	vsf_perimeter(win -> vdi_handle, 0);

	/* Insert into windowlist. */
	{
		register windowptr winptr = (windowptr)&Firstwindow;

		while(winptr -> next)
		{
			winptr = winptr -> next;
			winptr -> place++;
		}
	
		winptr -> next = thewin;
	}

	convert_sect(thewin -> fonction.secteur.secteurBin, thewin -> fonction.text.Ligne, thewin -> fonction.secteur.ascii);

	/* initialise les ascenseurs */
	wind_set(win -> handle, WF_HSLSIZE, (int)(thewin -> win -> work.g_w *1000. / max_w), 0, 0, 0);

	wind_set(win -> handle, WF_VSLSIZE, 1000, 0, 0, 0);
	wind_set(win -> handle, WF_VSLIDE, 1000, 0, 0, 0);

	/* entr‚e dans le menu */
	get_menu_entry(thewin, thewin -> title +1);

	make_frontwin(thewin);

	menu_ienable(Menu, OUVRIR_TAMPON, 0);
	ajoute(Firstwindow, Messages(TAMPON_13));
} /* ouvrir_tampon */