Exemplo n.º 1
0
void Component::setBorders(Border* const TheBorder)
{
    setBorder        (TheBorder);
    setDisabledBorder(TheBorder);
    setFocusedBorder (TheBorder);
    setRolloverBorder(TheBorder);
}
Exemplo n.º 2
0
ZenTextEditor::ZenTextEditor(const String& componentName, const ImageBorderType& imageBorderType, const String& labelText, int componentWidth, int componentHeight)
	:TextEditor(componentName)
{
	Component::setSize(componentWidth, componentHeight);
	setText(labelText);
	if (imageBorderType == LargeBorder)
	{
		leftEndImage = ImageCache::getFromMemory(ZenBinaryData::textFieldLargeBorderLeftEnd_png, ZenBinaryData::textFieldLargeBorderLeftEnd_pngSize);
		rightEndImage = ImageCache::getFromMemory(ZenBinaryData::textFieldLargeBorderRightEnd_png, ZenBinaryData::textFieldLargeBorderRightEnd_pngSize);
		centerImage = ImageCache::getFromMemory(ZenBinaryData::textFieldLargeBorderCenter_png, ZenBinaryData::textFieldLargeBorderCenter_pngSize);
		fullImage = ImageCache::getFromMemory(ZenBinaryData::textFieldLargeBorderFull_png, ZenBinaryData::textFieldLargeBorderFull_pngSize);
	} else
	{
		leftEndImage = ImageCache::getFromMemory(ZenBinaryData::textFieldSmallBorderLeftEnd_png, ZenBinaryData::textFieldSmallBorderLeftEnd_pngSize);
		rightEndImage = ImageCache::getFromMemory(ZenBinaryData::textFieldSmallBorderRightEnd_png, ZenBinaryData::textFieldSmallBorderRightEnd_pngSize);
		centerImage = ImageCache::getFromMemory(ZenBinaryData::textFieldSmallBorderCenter_png, ZenBinaryData::textFieldSmallBorderCenter_pngSize);
		fullImage = ImageCache::getFromMemory(ZenBinaryData::textFieldSmallBorderFull_png, ZenBinaryData::textFieldSmallBorderFull_pngSize);
	}
	this->setColour(textColourId, Colours::antiquewhite);
	this->setColour(backgroundColourId, Colour(0.0f));  //transparent background since we're drawing image
	this->setColour(highlightColourId, Colours::white);
	this->setColour(CaretComponent::caretColourId, Colour(0xffc3c3c3));
	
	Typeface::Ptr tface = Typeface::createSystemTypefaceFor(ZenBinaryData::futurabook_ttf, ZenBinaryData::futurabook_ttfSize);
	Font textFont(tface);
	
	textFont.setHeight(14.0f);
	this->setFont(textFont);
	addComponentListener(this);
	
	setBorder(BorderSize<int>(1, 5, 1, 5 ));	
}
Exemplo n.º 3
0
void Enemy1::createObject2D() {
	/*
		square1: 40 x 40
	*/
	Rectangle2D *square1;
	Polygon2D *square2;

	square1 = new Rectangle2D(Point2D(-100, 70), 40, 40, Color(0,1,0), false);
	square2 = new Polygon2D(Color(0,1,0), false);
	square2->addPoint(Point2D(-100, 90));
	square2->addPoint(Point2D(-80, 70));
	square2->addPoint(Point2D(-60, 90));
	square2->addPoint(Point2D(-80, 110));

	shapes.push_back(square1);
	shapes.push_back(square2);

	setBorder();
	for (int i = 0; i < borderSegments.size(); i++) {
		shapes.push_back(borderSegments[i]);
	}

	center = Point2D(-80, 90);
	position = center;
	speed = 2;
	angle = (float)rand() / 500;
	value = 10;
	setType(1);


}
Exemplo n.º 4
0
gTextArea::gTextArea(gContainer *parent) : gControl(parent)
{
	g_typ = Type_gTextArea;
	_align_normal = false;
	
	have_cursor = true;
	_undo_stack = NULL;
	_redo_stack = NULL;
	_not_undoable_action = 0;
	_undo_in_progress = false;
	
	onChange = 0;
	onCursor = 0;

	textview = gtk_text_view_new();
	realizeScrolledWindow(textview);

	setColorBase();

	//g_signal_connect_after(G_OBJECT(textview), "motion-notify-event", G_CALLBACK(cb_motion_notify_event), (gpointer)this);
	g_signal_connect(G_OBJECT(textview), "key-press-event", G_CALLBACK(cb_keypress), (gpointer)this);
	
	_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview));
	g_signal_connect_after(G_OBJECT(_buffer), "changed", G_CALLBACK(cb_changed), (gpointer)this);
	g_signal_connect_after(G_OBJECT(_buffer), "mark-set", G_CALLBACK(cb_mark_set), (gpointer)this);
	g_signal_connect(G_OBJECT(_buffer), "insert-text", G_CALLBACK(cb_insert_text), (gpointer)this);
	g_signal_connect(G_OBJECT(_buffer), "delete-range", G_CALLBACK(cb_delete_range), (gpointer)this);

	/*gtk_text_view_set_left_margin(GTK_TEXT_VIEW(textview), 2);
	gtk_text_view_set_right_margin(GTK_TEXT_VIEW(textview), 2);*/

	setBorder(true);
	setWrap(false);
}
Exemplo n.º 5
0
void InternalWindow::onCreate(const InternalWindow * Id)
{
	Inherited::onCreate(Id);

    if(Id != NULL)
    {
        if(Id->getTitlebar() != NULL)
        {
            FieldContainerUnrecPtr FCCopy(Id->getTitlebar()->shallowCopy());
            setTitlebar(dynamic_pointer_cast<Titlebar>(FCCopy));
        }
        if(Id->getBorder() != NULL)
        {
            FieldContainerUnrecPtr FCCopy(Id->getBorder()->shallowCopy());
            setBorder(dynamic_pointer_cast<Border>(FCCopy));
        }
        if(Id->getDisabledBorder() != NULL)
        {
            FieldContainerUnrecPtr FCCopy(Id->getDisabledBorder()->shallowCopy());
            setDisabledBorder(dynamic_pointer_cast<Border>(FCCopy));
        }
        if(Id->getFocusedBorder() != NULL)
        {
            FieldContainerUnrecPtr FCCopy(Id->getFocusedBorder()->shallowCopy());
            setFocusedBorder(dynamic_pointer_cast<Border>(FCCopy));
        }
        if(Id->getRolloverBorder() != NULL)
        {
            FieldContainerUnrecPtr FCCopy(Id->getRolloverBorder()->shallowCopy());
            setRolloverBorder(dynamic_pointer_cast<Border>(FCCopy));
        }
    }
}
Exemplo n.º 6
0
void IEView::clear(IEVIEWEVENT *event)
{
	CComPtr<IHTMLDocument2> document = getDocument();
	if (document == NULL) {
		pWebBrowser->Navigate(L"about:blank", NULL, NULL, NULL, NULL);
		HRESULT hr = S_OK;
		CComPtr<IHTMLDocument2> document;
		while ((document == NULL) && (hr == S_OK)) {
			Sleep(0);
			CComPtr<IDispatch> dispatch;
			if (SUCCEEDED(pWebBrowser->get_Document(&dispatch)) && dispatch != NULL)
				dispatch.QueryInterface(&document);
		}
	}
	else {
		document->close();
		VARIANT open_name, open_features, open_replace;
		
		VariantInit(&open_name);
		open_name.vt = VT_BSTR;
		open_name.bstrVal = SysAllocString(L"_self");
		VariantInit(&open_features);
		VariantInit(&open_replace);

		CComPtr<IDispatch> open_window;
		document->open(SysAllocString(L"text/html"), open_name, open_features, open_replace, &open_window);
	}
	if (builder != NULL)
		builder->clear(this, event);

	clearRequired = false;
	getFocus = false;
	setBorder();
}
Exemplo n.º 7
0
DbTable::DbTable(list<ColumnConfig> cc,const litesql::Expr & expr,Wt::WContainerWidget * parent):
    Wt::Ext::TableView(parent),
    _column_config(cc),
    _sql(sql) {
    setBorder(false);
    model=new DbTableModel(cc,expr,parent);
    setModel(model);
    setAlternatingRowColors(true);
    resizeColumnsToContents(true);
    setHighlightMouseOver(true);
    setSelectionBehavior(Wt::SelectRows);
    setSelectionMode(Wt::SingleSelection);
    std::list<ColumnConfig>::iterator confit=cc.begin();
    for(int a=0; confit!=cc.end(); confit++, a++) {
//          enableColumnHiding(a, true);
//          setColumnSortable(a, true);
        setColumnWidth(a,(*confit).getWidth());
    }
    _clickCount=0;
    cellClicked().connect(SLOT(this,DbTable::itemSelected));
    doubleClickTimer=new Wt::WTimer(this);
    doubleClickTimer->setInterval(200);
    doubleClickTimer->timeout().connect(SLOT(this, DbTable::emitClickCount));

}
Exemplo n.º 8
0
void core::DotMatrix::init(int dotSize, int rows, int cols, DataFormat dt)
{
	this->size = dotSize;

	//QActions
	continuousDrawingAction = new QAction(ICON_FREEHAND, "Dibujo continuo", this);
	clearAction = new QAction(ICON_CLEAR, "Limpiar", this);
	fillAction = new QAction(ICON_FILL, "Llenar", this);
	eraserAction = new QAction(ICON_ERASER, "Borrador", this);

	continuousDrawingAction->setCheckable(true);
	eraserAction->setCheckable(true);

	contextMenu.insertAction(getLockAction(), continuousDrawingAction);
	contextMenu.insertAction(continuousDrawingAction, fillAction);
	contextMenu.insertAction(fillAction, clearAction);
	contextMenu.insertAction(clearAction, eraserAction);

	setEnableContinuousDrawing(true);
	setEnableEraserPen(false);

	setRows(rows);
	setCols(cols);

	setEnableEdit(true);
	setBorder(QPen(Qt::black, 1));
	setContainerRect(getContainer());
	setDataType(dt);

	connect(continuousDrawingAction, SIGNAL(triggered(bool)), SLOT(setEnableContinuousDrawing(bool)));
	connect(clearAction, SIGNAL(triggered()), SLOT(clear()));
	connect(fillAction, SIGNAL(triggered()), SLOT(fill()));
	connect(eraserAction, SIGNAL(triggered(bool)), SLOT(setEnableEraserPen(bool)));
}
Exemplo n.º 9
0
cTankWars2005::cTankWars2005()
{
   srand(time(0));

   // added so we can have Rich Text boxes in the game
	AfxInitRichEdit();
   //

   tws2005 = this;
   pop_app = gpop_app;
   status = pop_app->pMainFrame->main_status;

   level_selector = new cLevelSelector();

   tlevel = new cTitleLevel();
   level_selector->AddLevel(tlevel);

   blevel = new cBattleLevel();
   level_selector->AddLevel(blevel);

   elevel = new cEndLevel();
   level_selector->AddLevel(elevel);

   options_data = new cOptionsData();
   options_data->Load();
   options_data->SetPlayerDefault(0);
   options_data->SetPlayerDefault(1);
   options_data->SetCurrentPlanet(0);

//Fix the menu selections you'll allow.
	_menuflags |= cGame::MENU_AUTOPLAY;
		 //Default _menuflags from cGame as hopper off autoplay off.  Turn on autoplay.
//_menuflags &= ~cGame::MENU_SHAPE;  // Turn off MENU_SHAPE
#ifdef TESTINGALLCONTROLS
	_menuflags |= cGame::MENU_SHAPE;
#endif //TESTINGALLCONTROLS
//Fix your statics
  	cCritter::MAXRADIUS = cTankWars2005::CRITTERMAXRADIUS;
  	cCritter::MAXSPEED = cTankWars2005::CRITTERMAXSPEED;

  	cCritterBullet::BULLETRADIUS = cTankWars2005::BULLETRADIUS;
	cCritterBullet::BULLETSPEED *= 1.1;


   //Set the cursor tools.
  	_arrayHCURSOR.Add(((CPopApp*)::AfxGetApp())->_hCursorPlay);
   _arrayHCURSOR.Add(((CPopApp*)::AfxGetApp())->_hCursorDragger);
   

	// Joseph E. Sutton
	setBorder(35.0, 8.0);

	/********Modifications by John P. Harris ******************/
	//setBorder calls fixSkyBox() whic sets the background stuff,
   setWrapflag(cCritter::CLAMP);

  	//cCritter::BOUNCE turns off wrap to make it easier to shoot things.
   //Make a player
}
Exemplo n.º 10
0
		NumberPicker::NumberPicker() : Component(new NumberPickerAdapter(this))
		{
#ifdef NATIVE_PLATFORM_WIN32
			static const Pen BORDER_COLOR = Color(0x80, 0x80, 0x80);

			setBorder(BORDER_COLOR);
#endif // NATIVE_PLATFORM_WIN32
		}
Exemplo n.º 11
0
	virtual void initialize()
	{
		Panel::initialize();

		setLayout(boost::make_shared<GridTransformerRendererLayout>());
		setBorder(boost::make_shared<gluit::SimpleBorder>());
		setPadding(0);
	}
Exemplo n.º 12
0
void CGUIPanel::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)
{
	IGUIElement::deserializeAttributes(in, options);

	setBorder(in->getAttributeAsBool("border"));
	setHScrollBarMode((E_SCROLL_BAR_MODE)in->getAttributeAsEnumeration("horizontalScrollBar", GUIScrollBarModeNames));
	setVScrollBarMode((E_SCROLL_BAR_MODE)in->getAttributeAsEnumeration("verticalScrollBar", GUIScrollBarModeNames));
}
Exemplo n.º 13
0
void Label::setTheme( Theme & t, const string prefix )
{
	Widget::setTheme( t, prefix );
  beginUpdate();
  setBorder( t.getBorder( prefix+"label" ) );
  setFont( t.getFont( prefix+"label" ) );
  setFontColor( t.getColor( prefix+"label_font" ) );
  endUpdate();
}
KarbonCalligraphicShape::KarbonCalligraphicShape(qreal caps)
        : m_lastWasFlip(false),
        m_caps(caps)
{
    setShapeId(KoPathShapeId);
    setFillRule(Qt::WindingFill);
    setBackground(new KoColorBackground(Qt::black));
    setBorder(0);
}
Exemplo n.º 15
0
//-----------------------------------------------------------------------------
// Purpose: Create the ScoreBoard panel
//-----------------------------------------------------------------------------
ScorePanel::ScorePanel(int x,int y,int wide,int tall) : Panel(x,y,wide,tall)
{
	setBorder( new LineBorder( Color(255 * 0.7,170 * 0.7,0,0) ) );
	setBgColor( 0,0,0, 100 );

	m_pTitleLabel = new Label( "  SCORES", 0,0, wide, SBOARD_TITLE_SIZE_Y );
	m_pTitleLabel->setBgColor( Scheme::sc_primary2 );
	m_pTitleLabel->setFgColor( Scheme::sc_primary1 );
	m_pTitleLabel->setContentAlignment( vgui::Label::a_west );
	m_pTitleLabel->setParent(this);

	_headerPanel = new HeaderPanel( SBOARD_TABLE_X, SBOARD_TITLE_SIZE_Y, wide - (SBOARD_TABLE_X * 2), SBOARD_HEADER_SIZE_Y);
	_headerPanel->setParent(this);

	// BUGBUG: This isn't working. gHUD.m_Teamplay hasn't been initialized yet.
	if ( gHUD.m_Teamplay )
		_headerPanel->addSectionPanel( new CLabelHeader( CHudTextMessage::BufferedLocaliseTextString( "#TEAMS" ), true) );
	else
		_headerPanel->addSectionPanel( new CLabelHeader( CHudTextMessage::BufferedLocaliseTextString( "#PLAYERS" ), true) );

	if ( HUD_IsGame( "tfc" ) )
		_headerPanel->addSectionPanel( new CLabelHeader( CHudTextMessage::BufferedLocaliseTextString( "#CLASS" ), true) );
	else
		_headerPanel->addSectionPanel( new CLabelHeader("", true) );

	_headerPanel->addSectionPanel( new CLabelHeader( CHudTextMessage::BufferedLocaliseTextString( "#SCORE" )) );
	_headerPanel->addSectionPanel( new CLabelHeader( CHudTextMessage::BufferedLocaliseTextString( "#DEATHS")) );
	_headerPanel->addSectionPanel( new CLabelHeader( CHudTextMessage::BufferedLocaliseTextString( "#LATENCY")) );
	_headerPanel->setBgColor( 0,0,0, 255 );

	// Need to special case 400x300, because the titles just wont fit otherwise
	if ( ScreenWidth == 400 )
	{
		_headerPanel->setSliderPos( 0, SMALL_CSIZE_NAME );
		_headerPanel->setSliderPos( 1, SMALL_CSIZE_CLASS );
		_headerPanel->setSliderPos( 2, SMALL_CSIZE_KILLS );
		_headerPanel->setSliderPos( 3, SMALL_CSIZE_DEATHS );
		_headerPanel->setSliderPos( 4, wide - (SBOARD_TABLE_X * 2) - 1 );
	}
	else
	{
		_headerPanel->setSliderPos( 0, CSIZE_NAME );
		_headerPanel->setSliderPos( 1, CSIZE_CLASS );
		_headerPanel->setSliderPos( 2, CSIZE_KILLS );
		_headerPanel->setSliderPos( 3, CSIZE_DEATHS );
		_headerPanel->setSliderPos( 4, wide - (SBOARD_TABLE_X * 2) - 1 );
	}

	_tablePanel = new ScoreTablePanel(SBOARD_TABLE_X, SBOARD_TABLE_Y, wide - (SBOARD_TABLE_X * 2), tall - SBOARD_TABLE_Y, NUM_COLUMNS);
	_tablePanel->setParent(this);
	_tablePanel->setHeaderPanel(_headerPanel);
	_tablePanel->setBgColor( 0,0,0, 255 );

	Initialize();
}
Exemplo n.º 16
0
Menu::Menu (Session* parent, int deleteOnReleaseKey) :
    Window(parent, parent->highestWindowLayer(), true, true),
    _deleteOnReleaseKey(deleteOnReleaseKey)
{
    setBorder(new FrameBorder());
    setLayout(new TableLayout(1));

    if (deleteOnReleaseKey != -1) {
        setFocus(this);
    }
}
      void PresetsEditorWindow::buildGui() {
        resize(830, 500);
        setBorder(false);
        setLayout(new Wt::WFitLayout());
        addButton(new Wt::Ext::Button("Cancel"));
        buttons().back()->clicked().connect(SLOT(this, PresetsEditorWindow::cancel));
        buttons().back()->setIcon("icons/remove-icon.png");

        addButton(new Wt::Ext::Button("Save"));
        buttons().back()->clicked().connect(SLOT(this, PresetsEditorWindow::save));
        buttons().back()->setIcon("icons/accept-icon.png");
      }
Exemplo n.º 18
0
InformationPanel::InformationPanel(GuiManager* manager)
   : GuiPanel( manager )
{

   setBackground(ColourPalette::GREY8);
   setBorder(ColourPalette::WHITE);

   m_isEmpty = true;

   m_manager->getEIManager()->EIEvents().registerCallback(EIEventType::ENTIITY_HOVERED,
    std::bind(&InformationPanel::onGameObjHover, this, std::placeholders::_1) );
}
Exemplo n.º 19
0
void initDungeon(){
    setBorder();
    int i, j;
    for (i = 1; i < 79; i++) {
        for (j = 1; j < 20; j++) {
            tile_t t;
            t.type = ' ';
            t.hardness = rand()%254 + 1;
            t.immutable = 0;
            t.character.value = none;
            dungeon[i][j] = t;
        }
    }
}
Exemplo n.º 20
0
IEView::IEView(HWND _parent, HTMLBuilder *_builder, int x, int y, int cx, int cy)
{
	MSG msg;
	parent = _parent;
	builder = _builder;
	rcClient.left = x;
	rcClient.top = y;
	rcClient.right = x + cx;
	rcClient.bottom = y + cy;
	if (SUCCEEDED(pWebBrowser.CoCreateInstance(CLSID_WebBrowser, NULL, CLSCTX_INPROC))) {
		CComPtr<IOleObject> pOleObject;
		if (SUCCEEDED(pWebBrowser.QueryInterface(&pOleObject))) {
			pOleObject->SetClientSite(this);
			pOleObject->DoVerb(OLEIVERB_INPLACEACTIVATE, &msg, this, 0, this->parent, &rcClient);
		}
		else MessageBox(NULL, TranslateT("IID_IOleObject failed."), TranslateT("RESULT"), MB_OK);

		CComPtr<IOleInPlaceObject> pOleInPlace;
		if (SUCCEEDED(pWebBrowser.QueryInterface(&pOleInPlace)))
			pOleInPlace->GetWindow(&hwnd);
		else
			MessageBox(NULL, TranslateT("IID_IOleInPlaceObject failed."), TranslateT("RESULT"), MB_OK);

		setBorder();
		CComPtr<IConnectionPointContainer> pCPContainer;
		// Step 1: Get a pointer to the connection point container.
		if (SUCCEEDED(pWebBrowser.QueryInterface(&pCPContainer))) {
			// m_pConnectionPoint is defined like this:
			// Step 2: Find the connection point.
			if (SUCCEEDED(pCPContainer->FindConnectionPoint(DIID_DWebBrowserEvents2, &m_pConnectionPoint))) {
				// Step 3: Advise the connection point that you
				// want to sink its events.
				sink = new IEViewSink(this);
				if (FAILED(m_pConnectionPoint->Advise(sink, &m_dwCookie)))
					MessageBox(NULL, TranslateT("Failed to Advise"), TranslateT("C++ Event Sink"), MB_OK);
			}
		}
		setMainWndProc((WNDPROC)SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)IEViewWindowProcedure));
	}
	{
		mir_cslock lck(mutex);
		next = list;
		if (next != NULL)
			next->prev = this;
		list = this;
	}

	pWebBrowser->put_RegisterAsDropTarget(VARIANT_FALSE);
}
Exemplo n.º 21
0
HexColorEntry::HexColorEntry()
  : Box(JI_HORIZONTAL)
  , m_label("#")
  , m_entry(6, "")
{
  addChild(&m_label);
  addChild(&m_entry);

  m_entry.EntryChange.connect(&HexColorEntry::onEntryChange, this);

  initTheme();

  setBorder(gfx::Border(2*jguiscale(), 0, 0, 0));
  child_spacing = 0;
}
Exemplo n.º 22
0
ViewObject::ViewObject(int on_level){

	//Object attributes
	setSolidness(SPECTRAL);
	setAltitude(MAX_ALTITUDE);
	setType("ViewObject");


	//ViewObject attributes
	setValue(0);
	setBorder(true);
	setLocation(TOP_CENTER);
	setColor(COLOR_DEFAULT);

	//Register interest in view events
	registerInterest(VIEW_EVENT);
}
Exemplo n.º 23
0
ConfirmationDialog::ConfirmationDialog(GuiManager* manager, std::string title, std::string message)
   : GuiDialog(manager, false), m_title(title), m_message(message)
{
   setBackground(ColourPalette::GREY8);
   setBorder(ColourPalette::WHITE);

   m_titleText = addChildWindow<GuiStaticText>(title);
   m_labelText = addChildWindow<GuiStaticText>(message);
   m_yesButton = addChildWindow<GuiLabelButton>(IDYES, "Yes");
   m_noButton = addChildWindow<GuiLabelButton>(IDNO, "No");
   
   m_yesButton.get()->GUIEvts().registerCallback(GuiEvtType::MOUSE_DOWN,
        std::bind(&ConfirmationDialog::onYesButton, this, std::placeholders::_1));

   m_yesButton.get()->setSize({50, 30});
   m_noButton.get()->setSize({50, 30});
}
Exemplo n.º 24
0
		TEMP_PAR
		void NUM_SYS::compute()
		{
			//Calculate inverse:
			IntSmithNormalForm snf(_base,
					                   true, /* use shape correction */
														 IntSmithNormalForm::LEFT_POSITIVE);
			IntAdjointMatrix adjointForm(_base);
			IMatrix adj = adjointForm["ADJOINT"];
			_G = snf["S"];
			_U = snf["U"];
      BaseProperties props = calculateBaseProperties();
			setBorder();

			createHashTable();

			FMatrix f_adj = I_FConverter::template convertMatrix<Matrix>(adj);
      FMatrix f_G = I_FConverter::template convertMatrix<Matrix>(_G);

      FLOAT_TYPE determinant = FMCalculator::calculateDeterminant(f_G);
			_baseInverse = number_traits_float::multiplicativeUnit/determinant * f_adj;

      if (!(props & EXPANSIVE))
      {
        throw Exceptions::RuntimeException("Number system is not expansive", PROP_EXC_ID);
      }
      else if (!(props & REGULAR))
      {
        throw Exceptions::RuntimeException("Number system is not regular", PROP_EXC_ID);
      }
      else if (!(props & DETERMINANT_NOT_ONE))
      {
        throw Exceptions::RuntimeException("Number system determinant error",
                                           PROP_EXC_ID);
      }
			

      props = calculateBaseProperties();
      if (!(props & CONGRUENT_DIGITSET))
      {
        throw Exceptions::RuntimeException("Number system hasn't got congruent digits",
                                           PROP_EXC_ID);
      }

		}
Exemplo n.º 25
0
void
compiz::window::Geometry::applyChange (const compiz::window::Geometry &g, unsigned int mask)
{
    if (mask & CHANGE_X)
	setX (g.x ());

    if (mask & CHANGE_Y)
	setY (g.y ());

    if (mask & CHANGE_WIDTH)
	setWidth (g.width ());

    if (mask & CHANGE_HEIGHT)
	setHeight (g.height ());

    if (mask & CHANGE_BORDER)
	setBorder (g.border ());
}
Exemplo n.º 26
0
void IEView::clear(IEVIEWEVENT *event)
{
	IHTMLDocument2 *document = getDocument();
	if (document == NULL) {
		pWebBrowser->Navigate(L"about:blank", NULL, NULL, NULL, NULL);
		HRESULT hr = S_OK;
		IHTMLDocument2 *document = NULL;
		while ((document == NULL) && (hr == S_OK)) {
			Sleep(0);
			IDispatch *dispatch = NULL;
			if (SUCCEEDED(pWebBrowser->get_Document(&dispatch)) && (dispatch != NULL)) {
				hr = dispatch->QueryInterface(IID_IHTMLDocument2, (void **)&document);
				dispatch->Release();
			}
		}
		if (document != NULL) {
			document->Release();
		}
	}
	else {
		document->close();
		VARIANT open_name, open_features, open_replace;
		IDispatch *open_window = NULL;
		VariantInit(&open_name);
		open_name.vt = VT_BSTR;
		open_name.bstrVal = SysAllocString(L"_self");
		VariantInit(&open_features);
		VariantInit(&open_replace);

		document->open(SysAllocString(L"text/html"), open_name, open_features, open_replace, &open_window);
		if (open_window != NULL)
			open_window->Release();
		document->Release();
	}
	if (builder != NULL)
		builder->clear(this, event);

	clearRequired = false;
	getFocus = false;
	setBorder();
}
Exemplo n.º 27
0
void Popup::setTheme( Theme & t, const string prefix )
{
  setBorder( t.getBorder( prefix+"popup" ) );
}
Exemplo n.º 28
0
Arquivo: zombie.c Projeto: xhkz/zombie
int main(int argc, char **argv)
{

    int threadsLimit = 0;

    int c;
    while ((c = getopt (argc, argv, "n:t")) != -1)
    {
        switch (c)
        {
        case 'n':
            threadsLimit = atoi(optarg);
            break;
        case 't':
            benchmark = true;
            break;
        default:
            ;
        }
    }
    
    if (threadsLimit) {
        omp_set_dynamic(0);
        omp_set_num_threads(threadsLimit);
    }
    
    clock_t start;
    start = clock();

    bool *locks = (bool *)malloc((SIZEX + 2) * sizeof(bool));
    for (int i = 0; i < SIZEX + 2; i++)
        locks[i] = false;

    MPI_Init(&argc, &argv);
    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
    MPI_Comm_size(MPI_COMM_WORLD, &size);

    initRandom(0, rank);
    Entity **matrix_a = createMatrix(SIZEX + 2, SIZEY + 2);
    Entity **matrix_b = createMatrix(SIZEX + 2, SIZEY + 2);
    initMatrix(matrix_a, SIZEX, SIZEY);

    MPI_Type_contiguous(sizeof(Entity), MPI_BYTE, &cell_t);
    MPI_Type_commit(&cell_t);
    MPI_Type_vector(SIZEX + 2, 1, 1, cell_t, &row_t);
    MPI_Type_commit(&row_t);
    MPI_Type_contiguous(sizeof(Counter), MPI_BYTE, &counter_t);
    MPI_Type_commit(&counter_t);

    Entity * northBuffer = (Entity *) malloc((SIZEX + 2) * sizeof(Entity));
    Entity * southBuffer = (Entity *) malloc((SIZEX + 2) * sizeof(Entity));

    if (!benchmark) {
        // update local counter and sync
        updateCounter(matrix_a);
        syncCounter();
        printHeader(rank);
        printCSV(0, rank);
    }

    for (int n = 0; n < STEPS; n++)
    {
        // set adjacent borders
        if (rank == NORTH)
        {
            MPI_Recv(northBuffer, 1, row_t, SOUTH, TAG, MPI_COMM_WORLD, &status);
            setBorder(northBuffer, matrix_a, SIZEY+1);

            setBuffer(matrix_a, northBuffer, SIZEY);
            MPI_Send(northBuffer, 1, row_t, SOUTH, TAG, MPI_COMM_WORLD);
        }

        if (rank == SOUTH)
        {
            setBuffer(matrix_a, southBuffer, 1);
            MPI_Send(southBuffer, 1, row_t, NORTH, TAG, MPI_COMM_WORLD);

            MPI_Recv(southBuffer, 1, row_t, NORTH, TAG, MPI_COMM_WORLD, &status);
            setBorder(southBuffer, matrix_a, 0);
        }

        #pragma omp parallel for default(none) shared(matrix_a, matrix_b, n, locks) schedule(static, SIZEX/omp_get_max_threads())
        for (int i = 1; i <= SIZEX; i++)
        {
            lock(i, locks);
            #pragma omp parallel for
            for (int j = 1; j <= SIZEY; j++)
                process(matrix_a, matrix_b, i, j);

            unlock(i, locks);
        }

        // merge adjacent border
        if (rank == NORTH)
        {
            MPI_Recv(northBuffer, 1, row_t, SOUTH, TAG, MPI_COMM_WORLD, &status);
            mergeGhost(northBuffer, matrix_b, SIZEY);

            setGhost(matrix_b, northBuffer, SIZEY+1);
            MPI_Send(northBuffer, 1, row_t, SOUTH, TAG, MPI_COMM_WORLD);
        }

        if (rank == SOUTH)
        {
            setGhost(matrix_b, southBuffer, 0);
            MPI_Send(southBuffer, 1, row_t, NORTH, TAG, MPI_COMM_WORLD);

            MPI_Recv(southBuffer, 1, row_t, NORTH, TAG, MPI_COMM_WORLD, &status);
            mergeGhost(southBuffer, matrix_b, 1);
        }

        // clear original adjacent border in matrix_a
        for (int i = 0; i < SIZEX + 2; i++)
            clearEntity(&matrix_a[i][rank == NORTH ? SIZEY + 1 : 0]);

        //some times it can not move back, then stay in the border
        transferInBorder(matrix_a, matrix_b);
        moveBackInBorder(matrix_b);

        // swap matrixes
        Entity **matrix_t = matrix_a;
        matrix_a = matrix_b;
        matrix_b = matrix_t;

        if (!benchmark)
        {
            updateCounter(matrix_a);
            syncCounter();
            printCSV(n+1, rank);
        }
    }
    
    if (benchmark)
        printf("Thread: %d, Time: %f sec\n", omp_get_max_threads(), (double)(clock() - start) / CLOCKS_PER_SEC);

    destroyMatrix(matrix_a);
    destroyMatrix(matrix_b);
    
    free(northBuffer);
    free(southBuffer);

    MPI_Finalize();

    return 0;
}
Exemplo n.º 29
0
int main(){
	Border smallBorder, bigBorder, blankContent, topBorder, bottomBorder;
	
	setBorder(smallBorder, VERTICALDOUBLELINECHAR, HORIZONTALLINECHAR, CENTRECHAR, VERTICALDOUBLELINECHAR, VERTICALDOUBLELINECHAR);
	setBorder(bigBorder, LEFTMIDDLECHAR, HORIZONTALDOUBLELINECHAR, HORIZONTALDOUBLELINECHAR, DOUBLECENTRECHAR, RIGHTMIDDLECHAR);
	setBorder(blankContent, VERTICALDOUBLELINECHAR, BLANK, VERTICALLINECHAR, VERTICALDOUBLELINECHAR, VERTICALDOUBLELINECHAR);
	setBorder(topBorder, TOPLEFTCORNERCHAR, HORIZONTALDOUBLELINECHAR, HORIZONTALDOUBLELINECHAR, TOPMIDDLECHAR, TOPRIGHTCORNERCHAR);
	setBorder(bottomBorder, BOTTOMLEFTCORNERCHAR, HORIZONTALDOUBLELINECHAR, HORIZONTALDOUBLELINECHAR, BOTTOMMIDDLECHAR, BOTTOMRIGHTCORNERCHAR);
	
	DoubleIntArrPointer *possibleResult;
	possibleResult = new DoubleIntArrPointer[SIZE];
	int finalSolution [SIZE][SIZE];
	int possibleLength [SIZE][SIZE];
	
	setUpGiven(finalSolution);
	setUpPossible(possibleResult);
	setUpGivenPossibility(possibleResult, finalSolution, possibleLength);
	setUpChecks(possibleResult, finalSolution, possibleLength);
	
	while(!isSolved(possibleLength)){
		enterSequential(possibleResult, finalSolution, possibleLength);
		
		updateTrickColumn(possibleResult, finalSolution, possibleLength);
		updateTrickRow(possibleResult, finalSolution, possibleLength);
		
		for(int i = 1; i <= 9; i++){
			enterBox(possibleResult, finalSolution, possibleLength, i);
			enterNumber(possibleResult, finalSolution, possibleLength, i, ROWMODE);
			enterNumber(possibleResult, finalSolution, possibleLength, i, COLMODE);
			updateTrickRowAdvanced(possibleResult, finalSolution, possibleLength, i);
			updateTrickColAdvanced(possibleResult, finalSolution, possibleLength, i);
		}
	}
	
	for (int bigVerBox = 0; bigVerBox < VERBOX; bigVerBox++){
		for (int smallVerBox = 0; smallVerBox < VERBOX; smallVerBox++){
			if(smallVerBox == 0){				
				if (bigVerBox == 0){
					drawBorder(topBorder);
				}else{
					drawBorder(bigBorder);
				}
			}else{
				drawBorder(smallBorder);
			}
			
			for (int bigBox = 0; bigBox < HORBOX; bigBox++){
				for (int smallBox = 0; smallBox < HORBOX; smallBox++){
					if(smallBox == 0){
						if(bigBox != 0){
							printf("%c", blankContent.secondBorder);
						}else{
							printf("%c", blankContent.firstBorder);
						}
					}else{
						printf("%c", blankContent.innerBorder);
					}
					printf("%d", finalSolution[bigBox*3 + smallBox][bigVerBox*3 + smallVerBox]);
				}
			}
			printf("%c\n", blankContent.endBorder);
		}		
	}
	drawBorder(bottomBorder);
}
Exemplo n.º 30
0
//-----------------------------------------------------------------------------
// Purpose: Create the ScoreBoard panel
//-----------------------------------------------------------------------------
ScorePanel::ScorePanel(int x,int y,int wide,int tall) : Panel(x,y,wide,tall)
{
	CSchemeManager *pSchemes = gViewPort->GetSchemeManager();
	SchemeHandle_t hTitleScheme = pSchemes->getSchemeHandle("Scoreboard Title Text");
	SchemeHandle_t hSmallScheme = pSchemes->getSchemeHandle("Scoreboard Small Text");
	SchemeHandle_t hTinyScheme = pSchemes->getSchemeHandle("Scoreboard Tiny Text");
	Font *tfont = pSchemes->getFont(hTitleScheme);
	Font *smallfont = pSchemes->getFont(hSmallScheme);
	Font *tinyfont = pSchemes->getFont(hTinyScheme);
	
	setBgColor(0, 0, 0, 96);
	m_pCurrentHighlightLabel = NULL;
	m_iHighlightRow = -1;
	// puzl: 0001073
	m_pTrackerIcon = NULL;
	m_pDevIcon = NULL;
	m_pPTIcon = NULL;
	m_pGuideIcon = NULL;
	m_pServerOpIcon = NULL;
	m_pContribIcon = NULL;
	m_pCheatingDeathIcon = NULL;
	m_pVeteranIcon = NULL;
	
	m_pTrackerIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardtracker.tga");
	m_pDevIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboarddev.tga");
	m_pPTIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardpt.tga");
	m_pGuideIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardguide.tga");
	m_pServerOpIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardserverop.tga");
	m_pContribIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardcontrib.tga");
	m_pCheatingDeathIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardcd.tga");
	m_pVeteranIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardveteran.tga");

	m_iIconFrame = 0;
	m_iLastFrameIncrementTime = gHUD.GetTimeOfLastUpdate();
	
	// Initialize the top title.
	m_TitleLabel.setFont(tfont);
	m_TitleLabel.setText("");
	m_TitleLabel.setBgColor( 0, 0, 0, 255 );
	m_TitleLabel.setFgColor( Scheme::sc_primary1 );
	m_TitleLabel.setContentAlignment( vgui::Label::a_west );

	LineBorder *border = new LineBorder(Color(60, 60, 60, 128));
	setBorder(border);
	setPaintBorderEnabled(true);

	int xpos = g_ColumnInfo[0].m_Width + 3;
	if (ScreenWidth() >= 640)
	{
		// only expand column size for res greater than 640
		xpos = XRES(xpos);
	}
	m_TitleLabel.setBounds(xpos, 4, wide, SBOARD_TITLE_SIZE_Y);
	m_TitleLabel.setContentFitted(false);
	m_TitleLabel.setParent(this);

	// Setup the header (labels like "name", "class", etc..).
	m_HeaderGrid.SetDimensions(NUM_COLUMNS, 1);
	m_HeaderGrid.SetSpacing(0, 0);
	
	for(int i=0; i < NUM_COLUMNS; i++)
	{
		if (g_ColumnInfo[i].m_pTitle && g_ColumnInfo[i].m_pTitle[0] == '#')
			m_HeaderLabels[i].setText(CHudTextMessage::BufferedLocaliseTextString(g_ColumnInfo[i].m_pTitle));
		else if(g_ColumnInfo[i].m_pTitle)
			m_HeaderLabels[i].setText(g_ColumnInfo[i].m_pTitle);

		int xwide = g_ColumnInfo[i].m_Width;
		if (ScreenWidth() >= 640)
		{
			xwide = XRES(xwide);
		}
		else if (ScreenWidth() == 400)
		{
			// hack to make 400x300 resolution scoreboard fit
			if (i == 1)
			{
				// reduces size of player name cell
				xwide -= 28;
			}
			else if (i == 0)
			{
				// tracker icon cell
				xwide -= 8;
			}
		}
		
		m_HeaderGrid.SetColumnWidth(i, xwide);
		m_HeaderGrid.SetEntry(i, 0, &m_HeaderLabels[i]);

		m_HeaderLabels[i].setBgColor(0,0,0,255);
		m_HeaderLabels[i].setBgColor(0,0,0,255);
		
        int theColorIndex = 0;
        Color gammaAdjustedTeamColor = BuildColor(kTeamColors[theColorIndex][0], kTeamColors[theColorIndex][1], kTeamColors[theColorIndex][2], gHUD.GetGammaSlope());
        int theR, theG, theB, theA;
        gammaAdjustedTeamColor.getColor(theR, theG, theB, theA);
        m_HeaderLabels[i].setFgColor(theR, theG, theB, theA);

		m_HeaderLabels[i].setFont(smallfont);
		m_HeaderLabels[i].setContentAlignment(g_ColumnInfo[i].m_Alignment);

		int yres = 12;
		if (ScreenHeight() >= 480)
		{
			yres = YRES(yres);
		}
		m_HeaderLabels[i].setSize(50, yres);
	}

	// Set the width of the last column to be the remaining space.
	int ex, ey, ew, eh;
	m_HeaderGrid.GetEntryBox(NUM_COLUMNS - 2, 0, ex, ey, ew, eh);
	m_HeaderGrid.SetColumnWidth(NUM_COLUMNS - 1, (wide - X_BORDER) - (ex + ew));

	m_HeaderGrid.AutoSetRowHeights();
	m_HeaderGrid.setBounds(X_BORDER, SBOARD_TITLE_SIZE_Y, wide - X_BORDER*2, m_HeaderGrid.GetRowHeight(0));
	m_HeaderGrid.setParent(this);
	m_HeaderGrid.setBgColor(0,0,0,255);


	// Now setup the listbox with the actual player data in it.
	int headerX, headerY, headerWidth, headerHeight;
	m_HeaderGrid.getBounds(headerX, headerY, headerWidth, headerHeight);
	m_PlayerList.setBounds(headerX, headerY+headerHeight, headerWidth, tall - headerY - headerHeight - 6);
	m_PlayerList.setBgColor(0,0,0,255);
	m_PlayerList.setParent(this);

	for(int row=0; row < NUM_ROWS; row++)
	{
		CGrid *pGridRow = &m_PlayerGrids[row];

		pGridRow->SetDimensions(NUM_COLUMNS, 1);
		
		for(int col=0; col < NUM_COLUMNS; col++)
		{
			m_PlayerEntries[col][row].setContentFitted(false);
			m_PlayerEntries[col][row].setRow(row);
			m_PlayerEntries[col][row].addInputSignal(this);
			pGridRow->SetEntry(col, 0, &m_PlayerEntries[col][row]);
		}

		pGridRow->setBgColor(0,0,0,255);
//		pGridRow->SetSpacing(2, 0);f
		pGridRow->SetSpacing(0, 0);
		pGridRow->CopyColumnWidths(&m_HeaderGrid);
		pGridRow->AutoSetRowHeights();
		pGridRow->setSize(PanelWidth(pGridRow), pGridRow->CalcDrawHeight());
		pGridRow->RepositionContents();

		m_PlayerList.AddItem(pGridRow);
	}


	// Add the hit test panel. It is invisible and traps mouse clicks so we can go into squelch mode.
	m_HitTestPanel.setBgColor(0,0,0,255);
	m_HitTestPanel.setParent(this);
	m_HitTestPanel.setBounds(0, 0, wide, tall);
	m_HitTestPanel.addInputSignal(this);

	m_pCloseButton = new CommandButton( "x", wide-XRES(12 + 4), YRES(2), XRES( 12 ) , YRES( 12 ) );
	m_pCloseButton->setParent( this );
	m_pCloseButton->addActionSignal( new CMenuHandler_StringCommandWatch( "-showscores", true ) );
	m_pCloseButton->setBgColor(0,0,0,255);
	m_pCloseButton->setFgColor( 255, 255, 255, 0 );
	m_pCloseButton->setFont(tfont);
	m_pCloseButton->setBoundKey( (char)255 );
	m_pCloseButton->setContentAlignment(Label::a_center);
	Initialize();
}