예제 #1
0
MCRectangle MCPlayer::getpreferredrect()
{
	if (!getstate(CS_PREPARED))
	{
		MCRectangle t_bounds;
		MCU_set_rect(t_bounds, 0, 0, formattedwidth, formattedheight);
		return t_bounds;
	}
    
	MCRectangle t_bounds;
	MCU_set_rect(t_bounds, 0, 0, 0, 0);
	return t_bounds;
}
예제 #2
0
bool MCNativeControl::ParseRectangle32(MCExecPoint& ep, MCRectangle32& r_rect)
{
	int32_t t_left, t_top, t_right, t_bottom;
	if (!MCU_stoi4x4(ep . getsvalue(), t_left, t_top, t_right, t_bottom))
	{
		MCeerror->add(EE_OBJECT_NAR, 0, 0, ep.getsvalue());
		return false;
	}
	
	MCU_set_rect(r_rect, t_left, t_top, t_right - t_left, t_bottom - t_top);
	return true;
}
예제 #3
0
void MCPrinter::Initialize(void)
{
    m_device_output_type = PRINTER_OUTPUT_DEVICE;
    m_device_output_location = NULL;
    m_device_command = NULL;
    m_device_font_table = NULL;
    m_device_features = 0;
    MCU_set_rect(m_device_rectangle, 0, 0, PRINTER_DEFAULT_PAGE_WIDTH, PRINTER_DEFAULT_PAGE_HEIGHT);

    m_page_width = PRINTER_DEFAULT_PAGE_WIDTH;
    m_page_height = PRINTER_DEFAULT_PAGE_HEIGHT;
    m_page_left_margin = 72;
    m_page_top_margin = 72;
    m_page_right_margin = 72;
    m_page_bottom_margin = 72;
    m_page_orientation = PRINTER_DEFAULT_PAGE_ORIENTATION;
    m_page_scale = 1.0;

    m_job_copies = PRINTER_DEFAULT_JOB_COPIES;
    m_job_collate = PRINTER_DEFAULT_JOB_COLLATE;
    m_job_name = NULL;
    m_job_duplex = PRINTER_DEFAULT_JOB_DUPLEX;
    m_job_color = PRINTER_DEFAULT_JOB_COLOR;
    m_job_range_count = PRINTER_PAGE_RANGE_ALL;
    m_job_ranges = NULL;

    m_layout_show_borders = false;
    m_layout_row_spacing = 36;
    m_layout_column_spacing = 36;
    m_layout_rows_first = true;
    m_layout_scale = 1.0;

    m_loop_nesting = 0;
    m_loop_layout_x = 0;
    m_loop_layout_y = 0;
    m_loop_layout_delta = 0;
    m_loop_error = NULL;
    m_loop_status = STATUS_READY;
    m_loop_page = 0;

    m_device = NULL;

    m_resync = true;

    DoInitialize();
}
예제 #4
0
void MCControl::layer_changeeffectiverect(const MCRectangle& p_old_effective_rect, bool p_force_update, bool p_update_card)
{
	// Compute the 'new' effectiverect based on visibility.
	MCRectangle t_new_effective_rect;
	if (getflag(F_VISIBLE) || MCshowinvisibles)
		t_new_effective_rect = geteffectiverect();
	else
		MCU_set_rect(t_new_effective_rect, 0, 0, 0, 0);

	// If the effective rect has not changed this is at most an update.
	if (MCU_equal_rect(p_old_effective_rect, t_new_effective_rect))
	{
		// If we are forcing an update, use the dirty method.
		if (p_force_update)
		{
			// If the layer is not scrolling just defer to the normal
			// dirty method; otherwise use the dirty content method.
			if (!layer_isscrolling())
				layer_dirtyeffectiverect(t_new_effective_rect, p_update_card);
			else
				layer_dirtycontentrect(layer_getcontentrect(), p_update_card);
		}

		// We are done.
		return;
	}

	// Fetch the tilecache, making it nil if the parent is a group (in the
	// latter case, this is just a dirty op).
	MCTileCacheRef t_tilecache;
	if (parent -> gettype() != CT_GROUP)
		t_tilecache = getstack() -> gettilecache();
	else
		t_tilecache = nil;
	
	// If no tilecache, then just dirty the old and new effective rects.
	if (t_tilecache == nil)
	{
		layer_dirtyeffectiverect(p_old_effective_rect, p_update_card);
		layer_dirtyeffectiverect(t_new_effective_rect, p_update_card);
		return;
	}

	// MW-2011-10-17: [[ Bug 9808 ]] Make sure we update the card regardless of
	//    whether we have a layer id - otherwise new objects don't show!
	// Add the rects to the update region - but only if instructed (update_card will be
	// false if the object was invisible).
	if (p_update_card)
	{
		static_cast<MCCard *>(parent) -> layer_dirtyrect(p_old_effective_rect);
		static_cast<MCCard *>(parent) -> layer_dirtyrect(t_new_effective_rect);
	}
	
	// We must be in tile-cache mode with a top-level control, but if the layer
	// id is zero, there is nothing to do.
	if (m_layer_id == 0)
		return;

	if (!layer_issprite())
	{
		// Non-dynamic layers are scenery in the tilecache, and we must use old
		// new effective rects so that the appropriate tiles get flushed. Note
		// that 'force_update' has no effect here as reshaping a scenery layer
		// implicitly invalidates all tiles it touches.
		MCTileCacheReshapeScenery(t_tilecache, m_layer_id, p_old_effective_rect, t_new_effective_rect);
	}
	else
	{
		// Dynamic layers are sprites in the tilecache, and there is nothing to
		// do unless 'force update' is required. In particular, if the layer is
		// just moving then no redraw of the layer will be needed. Note, however,
		// that this implicitly assumes that 'force update' is true if the content
		// in a sprite-relative co-ord system has changed.
		if (p_force_update)
		{
			MCRectangle t_rect;
			
			// If the layer is not scrolling, just use the width/height from the
			// effective rect; otherwise use content width/height.
			if (!layer_isscrolling())
				t_rect = p_old_effective_rect;
			else
				t_rect = layer_getcontentrect();
				
			MCTileCacheUpdateSprite(t_tilecache, m_layer_id, MCU_make_rect(0, 0, t_rect . width, t_rect . height));
		}
	}
}
예제 #5
0
void MCStack::mode_getrealrect(MCRectangle& r_rect)
{
	MCU_set_rect(r_rect, 0, 0, 0, 0);
}
예제 #6
0
Boolean MCNativeTheme::drawwidget(MCDC *dc, const MCWidgetInfo & winfo,
                                  const MCRectangle & drect)
{
	GC gc ;
	
	MCThemeDrawInfo di ;

	MCDC * t_dc = dc ;	
	Boolean ret = False;
	
	static MCRectangle gtkpixrect = {0,0,0,0};

	Display *display = MCdpy;

	GdkRectangle rect;
	GdkRectangle cliprect;

	MCRectangle trect = drect;
	MCRectangle crect = drect;

	if (winfo.type == WTHEME_TYPE_TAB)
		crect.height--; //make sure tab doesn't draw over tab pane
	

	
	rect = MCRectangleToGdkRectangle(trect);
	cliprect = MCRectangleToGdkRectangle(crect);
	rect.x = cliprect.x = 0;
	rect.y = cliprect.y = 0;


	if (rect.width <= 0 || rect.height <= 0)
		return False;
	GtkThemeWidgetType  moztype;
	gint flags = 0;
	GtkWidgetState state = getpartandstate(winfo, moztype, flags);

	
	
	switch(winfo.type)
	{
	case WTHEME_TYPE_TABPANE:
		state.curpos = 0;
		if(winfo.attributes & WTHEME_ATT_TABPOSBOTTOM
		        || winfo.attributes & WTHEME_ATT_TABPOSTOP)
			state.maxpos = rect.width;
		else if(winfo.attributes & WTHEME_ATT_TABPOSLEFT
		        || winfo.attributes & WTHEME_ATT_TABPOSRIGHT)
			state.maxpos = rect.height;
		else
			state.maxpos = rect.width; // XXX therefore default tabpos is top

		if(winfo.datatype == WTHEME_DATA_TABPANE)
		{

			MCWidgetTabPaneInfo *inf = (MCWidgetTabPaneInfo*)winfo.data;

			state.curpos = inf->gap_start - 1;
			state.maxpos = inf->gap_length + 2;

		}
		
		make_theme_info ( di, moztype, gtkpix, &rect, &cliprect, state, flags, crect);
		t_dc -> drawtheme ( THEME_DRAW_TYPE_GTK, &di ) ;
		
		ret = True;
		break;
		
		
	case WTHEME_TYPE_COMBO:
		{
			MCWidgetInfo twinfo = winfo;
			MCRectangle comboentryrect,combobuttonrect;
			//draw text box
			twinfo.part = WTHEME_PART_COMBOTEXT;
			getwidgetrect(twinfo, WTHEME_METRIC_PARTSIZE,drect,comboentryrect);
			twinfo.part = WTHEME_PART_COMBOBUTTON;
			getwidgetrect(twinfo, WTHEME_METRIC_PARTSIZE,drect,combobuttonrect);
			twinfo.type = WTHEME_TYPE_TEXTFIELD_FRAME;
			drawwidget(dc, twinfo, comboentryrect);
			twinfo.type = WTHEME_TYPE_COMBOBUTTON;
			drawwidget(dc, twinfo, combobuttonrect);
			return True;
		}
		
	
	
#define B_WIDTH 3
		
	case WTHEME_TYPE_TEXTFIELD_FRAME:
	{
		GtkWidgetState t_old_state;
		t_old_state = state;

		MCRectangle t_old_clip;
		t_old_clip = dc -> getclip();

		// crect is the target rectangle for the whole control
		// cliprect and rect are essentially the same
		
		GdkRectangle t_bounds;
		MCRectangle t_dst_bounds;
		MCRectangle t_clip;
		
		// First render the top and bottom borders. We render a control 8 pixels
		// high, but clipped to the border width.

		t_bounds . x = 0;
		t_bounds . y = 0;
		t_bounds . width = rect . width;
		t_bounds . height = 8;

		MCU_set_rect(t_dst_bounds, crect . x, crect . y, crect . width, 8);
		MCU_set_rect(t_clip, crect . x, crect . y, crect . width, B_WIDTH);
		make_theme_info(di, moztype, gtkpix, &t_bounds, &t_bounds, state, flags, t_dst_bounds);
		dc -> setclip(t_clip);
		dc -> drawtheme(THEME_DRAW_TYPE_GTK, &di);
		MCU_set_rect(t_dst_bounds, crect . x, crect . y + crect . height - 8, crect . width, 8);
		MCU_set_rect(t_clip, crect . x, crect . y + crect . height - B_WIDTH, crect . width, B_WIDTH);
		make_theme_info(di, moztype, gtkpix, &t_bounds, &t_bounds, state, flags, t_dst_bounds);
		dc -> setclip(t_clip);
		dc -> drawtheme(THEME_DRAW_TYPE_GTK, &di);
		
		// Now render the left and right borders. We render a control 8 pixels
		// wide, but clipped to the border width

		t_bounds . x = 0;
		t_bounds . y = 0;
		t_bounds . width = 8;
		t_bounds . height = rect . height;

		MCU_set_rect(t_dst_bounds, crect . x, crect . y, 8, crect . height);
		MCU_set_rect(t_clip, crect . x, crect . y + B_WIDTH, B_WIDTH, crect . height - 2 * B_WIDTH);
		make_theme_info(di, moztype, gtkpix, &t_bounds, &t_bounds, state, flags, t_dst_bounds);
		dc -> setclip(t_clip);
		dc -> drawtheme(THEME_DRAW_TYPE_GTK, &di);
		MCU_set_rect(t_dst_bounds, crect . x + crect . width - 8, crect . y, 8, crect . height);
		MCU_set_rect(t_clip, crect . x + crect . width - B_WIDTH, crect . y + B_WIDTH, B_WIDTH, crect . height - 2 * B_WIDTH);
		make_theme_info(di, moztype, gtkpix, &t_bounds, &t_bounds, state, flags, t_dst_bounds);
		dc -> setclip(t_clip);
		dc -> drawtheme(THEME_DRAW_TYPE_GTK, &di);

		dc -> setclip(t_old_clip);
	}
	break ;

		
	case WTHEME_TYPE_SLIDER:
		drawSlider(dc, winfo, drect);
		return True;
		break;
		
		
	case WTHEME_TYPE_SCROLLBAR:
		drawScrollbar(dc, winfo, drect);
		return True;
		break;
		
		
	case WTHEME_TYPE_PROGRESSBAR:
		ret = drawprogressbar(dc, winfo, drect);
		return ret;
		break;
		
		
	case WTHEME_TYPE_GROUP_FRAME:
		
		make_theme_info ( di, moztype, gtkpix, &rect, &cliprect, state, flags, crect);
		t_dc -> drawtheme ( THEME_DRAW_TYPE_GTK, &di ) ;
		ret = True;
		
	break;
		
		
	default:

		make_theme_info ( di, moztype, gtkpix, &rect, &cliprect, state, flags, crect);
		t_dc -> drawtheme ( THEME_DRAW_TYPE_GTK, &di ) ;
		ret = True;
	}
	
	return ret;
}
예제 #7
0
uint4 MCScreenDC::getdisplays(MCDisplay const *& p_displays, bool p_effective)
{
	if (s_monitor_count == 0)
	{
		bool error = false;
	
		uint4 t_display_count;
		
		t_display_count = 0;
		for(GDHandle t_device = GetDeviceList(); t_device != NULL; t_device = GetNextDevice(t_device))
			if (TestDeviceAttribute(t_device, screenDevice) && TestDeviceAttribute(t_device, screenActive))
				t_display_count += 1;
			
		error = t_display_count == 0;
		
		MCDisplay *t_displays = NULL;
		if (!error)
			error = (t_displays = new MCDisplay[t_display_count]) == NULL;
			
		if (!error)
		{
			uint4 t_current_index = 1;
			for(GDHandle t_device = GetDeviceList(); t_device != NULL; t_device = GetNextDevice(t_device))
				if (TestDeviceAttribute(t_device, screenDevice) && TestDeviceAttribute(t_device, screenActive))
				{
					uint4 t_index;
					
					HLock((Handle)t_device);
					
					if (TestDeviceAttribute(t_device, mainScreen))
						t_index = 0;
					else
						t_index = t_current_index++;
						
					t_displays[t_index] . index = t_index;
						
					t_displays[t_index] . viewport . x = (*t_device) -> gdRect . left;
					t_displays[t_index] . viewport . y = (*t_device) -> gdRect . top;
					t_displays[t_index] . viewport . width = (*t_device) -> gdRect . right - (*t_device) -> gdRect . left;
					t_displays[t_index] . viewport . height = (*t_device) -> gdRect . bottom - (*t_device) -> gdRect . top;
				
					Rect t_workarea;
					GetAvailableWindowPositioningBounds(t_device, &t_workarea);
					t_displays[t_index] . workarea . x = t_workarea . left;
					t_displays[t_index] . workarea . y = t_workarea . top;
					t_displays[t_index] . workarea . width = t_workarea . right - t_workarea . left;
					t_displays[t_index] . workarea . height = t_workarea . bottom - t_workarea . top;
					
					HUnlock((Handle)t_device);
				}
		}
		
		if (error)
			delete[] t_displays;
		else
		{
			s_monitor_count = t_display_count;
			s_monitor_displays = t_displays;
		}
	}
	
	if (s_monitor_count == 0)
	{
		static MCDisplay t_display;
		Rect t_workarea;
		
		MCU_set_rect(t_display . viewport, 0, 0, getwidth(), getheight());
		GetAvailableWindowPositioningBounds(GetMainDevice(), &t_workarea);
		t_display . index = 0;
		t_display . workarea . x = t_workarea . left;
		t_display . workarea . y = t_workarea . top;
		t_display . workarea . width = t_workarea . right - t_workarea . left;
		t_display . workarea . height = t_workarea . bottom - t_workarea . top;
		p_displays = &t_display;
		
		return 1;
	}
	
	p_displays = s_monitor_displays;
	return s_monitor_count;
}
예제 #8
0
bool MCRegionSetEmpty(MCRegionRef self)
{
	MCU_set_rect(self -> rect, 0, 0, 0, 0);
	return true;
}