Exemple #1
0
	void D3D12Render::v_init()
	{
		m_viewport.Width = getClientWidth();
		m_viewport.Height = getClientHeight();
		m_viewport.MaxDepth = 1.0f;

		m_scissorRect.right = static_cast<LONG>(getClientWidth());
		m_scissorRect.bottom = static_cast<LONG>(getClientHeight());

		loadPipeline();
		m_triangle.init(m_pD3D12Device);
		loadAssets();


	}
Exemple #2
0
Ascii2Dialog::Ascii2Dialog( Window *frame, Window *parent ) :
  Dialog( frame, parent, "",
          NOTITLE,
          0, 0, frame->getClientWidth(), frame->getClientHeight() - Notebook::getTabInset() )
{
  getGraphics()->setDialogFont();

  int margin = 10, fontHeight = fontHeight = Graphics::dialogDesignFontHeight,
      yStart = getClientHeight() - fontHeight,
      interSpace = fontHeight + fontHeight / 2,
      labelHeight = fontHeight + fontHeight / 3;

	int top = yStart;

  int editBoxHeight = EntryField::getInset() * 2 + fontHeight + 2;

	yStart -= fontHeight * 3;

  lineNumbersCheck  = new CheckBox( this, Strings::get(210),
                                         NEWGROUP|ISTABSTOP, 20, yStart, 150,
                                         fontHeight*2 );

  savedPositionsCheck  = new CheckBox( this, Strings::get(211),
                                         INGROUP, 180, yStart, 150,
                                         fontHeight*2 );

  yStart -= interSpace;

	Label *lbl = new Label( this, Label::RIGHT, Strings::get(213), 20,
                   yStart, 150, labelHeight );

	leftMarginCharsEntry = new EntryField( this, ISTABSTOP|BORDER, 180, yStart,
                                   	    130, editBoxHeight );
	
  yStart -= fontHeight / 2;

  GroupBox *gBox = new GroupBox( this, Strings::get(212), 0, 10, yStart,
                                 360, top - yStart );

	if( Settings::showLineNumbers )
		lineNumbersCheck->check( TRUE );

	if( Settings::showSavedPos )
		savedPositionsCheck->check( TRUE );

	char str[20];

	sprintf( str, "%d", Settings::leftMarginChars );
	leftMarginCharsEntry->setText( str );

	lineNumbersCheck->setFocus();

	setControlsVisible();		
}
int CTimelineControl::getY( float v )
{
	float paddingY = (float)OFFSET_Y;
	float height = (float)getClientHeight() - paddingY*2;
	
	if ( v <= m_minValue )
		return (int)(paddingY + height);
	else if ( v >= m_maxValue )
		return (int)paddingY;

	float posY = paddingY + (m_maxValue - v)*height/( m_maxValue - m_minValue );	
	return (int)posY;
}
Exemple #4
0
    void D3D11Render::init_camera()
    {
    	//view port Information
    	D3D11_VIEWPORT vp;
    	ZeroMemory(&vp, sizeof(D3D11_VIEWPORT));
    	vp.TopLeftX = 0;
    	vp.TopLeftY = 0;
    	vp.MinDepth = 0.0f;
    	vp.MaxDepth = 1.0f;
		vp.Width    = static_cast<FLOAT>(getClientWidth() );
		vp.Height   = static_cast<FLOAT>(getClientHeight() );
    	m_pD3D11DeviceContext->RSSetViewports(1, &vp);
    
    }
float CTimelineControl::getYValue( int y )
{
	float paddingY = (float)OFFSET_Y;
	float height = (float)getClientHeight() - paddingY*2;

	if ( y <= paddingY )
		return m_maxValue;
	if ( y >= paddingY + height )
		return m_minValue;

	float dy = (float)(y - paddingY);
	return m_maxValue - (m_maxValue - m_minValue)*dy/height;

}
Exemple #6
0
LRESULT MainWindow::onSize(UINT msg,WPARAM wParam,LPARAM lParam)
{
	CustomWindow::onSize(msg,wParam,lParam);
	//
	int w=getClientWidth();
	int h=getClientHeight();
	int y=getClientBottom();
	y-=2+24;
//	btnEnter->move( w-100- 2,y,100,24);
	btnPass->move(  w-200- 6,y,100,24);
	btnView->move(  w-300-10,y,100,24);
	for(int i=0;i<n_edtAns;i++){
		y-=2+24;
		edtAns[n_edtAns-1-i]->move(         2,y,w-4,24);
	}
	edtQes->move(         2,2,w-4,y-4);
	return 0L;
}
Exemple #7
0
// protected methods of FFileDialog
//----------------------------------------------------------------------
void FFileDialog::adjustSize()
{
  int X, Y;
  std::size_t max_width;
  std::size_t max_height;
  std::size_t h;
  auto root_widget = getRootWidget();

  if ( root_widget )
  {
    max_width = root_widget->getClientWidth();
    max_height = root_widget->getClientHeight();
  }
  else
  {
    // fallback to xterm default size
    max_width = 80;
    max_height = 24;
  }

  h = max_height - 6;

  if ( h < 15 )  // minimum
    h = 15;

  if ( h > 30 )  // maximum
    h = 30;

  setHeight (h, false);
  X = 1 + int((max_width - getWidth()) / 2);
  Y = 1 + int((max_height - getHeight()) / 3);
  setPos(FPoint(X, Y), false);
  filebrowser.setHeight (h - 8, false);
  hidden.setY (int(h) - 4, false);
  cancel.setY (int(h) - 4, false);
  open.setY (int(h) - 4, false);
  FDialog::adjustSize();
  printPath(directory);
}
Exemple #8
0
bool cWindow::isFullscreen() const {
	return getClientWidth() == ManagerSystem.getScreenWidth() && getClientHeight() == ManagerSystem.getScreenHeight();
}
void CTimelineControl::paintControl( uiGraphics *pG )
{
	if ( m_needSortValue == true )
	{
		sortValue(m_value);	
		calcMinMax(m_value);
		m_needSortValue = false;
	}

	int nWidth = getClientWidth();
	int nHeight = getClientHeight();
	
	uiBrush bgGrey( uiColor(0x9f9f9f) );
	uiBrush bgGreyDark( uiColor(0x666666) );

	uiFont tahoma(14, L"tahoma");
	tahoma.setFontNormal();

	uiGraphics *graphics = pG->createBackBuffer( nWidth, nHeight );
	
	// fill background
	graphics->drawFillRectangle(0,0, nWidth, nHeight, &bgGrey);	
		
	if ( m_timeLength > 0.0f )
	{
		// draw header & left
		graphics->drawFillRectangle(0,0, OFFSET_X, nHeight, &bgGreyDark);
		graphics->drawFillRectangle(0,0, nWidth, OFFSET_Y, &bgGreyDark);

		float midValue = (m_maxValue + m_minValue)*0.5f;	
		
		uiPen pen(1, PS_SOLID, uiColor(0x888888));
		uiPen penX(2, PS_SOLID, uiColor(0x0000ff));
		uiPen penY(2, PS_SOLID, uiColor(0x00ff00));
		uiPen penZ(2, PS_SOLID, uiColor(0xff0000));

		graphics->selectObject(&pen);

		// draw center line
		graphics->drawLine(0, getY(midValue), nWidth, getY(midValue));
		
		// draw limit line
		graphics->drawLine(0, getY(m_minValue), nWidth, getY(m_minValue));
		graphics->drawLine(0, getY(m_maxValue), nWidth, getY(m_maxValue));
		
		graphics->selectObject( &tahoma );
		graphics->setTextBkTransparent(true);
		
		wchar_t text[512];
		graphics->setTextColor( uiColor(0xffffff) );

		swprintf(text,512,L"%.2f", m_minValue);
		graphics->drawText( 5, getY(m_minValue), text );

		swprintf(text,512,L"%.2f", m_maxValue);
		graphics->drawText( 5, getY(m_maxValue), text );

		swprintf(text,512,L"%.2f", midValue);
		graphics->drawText( 5, getY(midValue), text );
		
		// set clipping
		graphics->setClip(OFFSET_X, 0, nWidth - OFFSET_X, nHeight);

		int len = (int)m_value.size();
		for ( int i = 1; i < len; i++ )
		{
			int x0 = getX( m_value[i-1].time );
			int x1 = getX( m_value[i].time );
									
			int y0 = getY( m_value[i-1].x );
			int y1 = getY( m_value[i].x );

			// draw col
			graphics->selectObject(&pen);
			graphics->drawLine(x1,0, x1,nHeight);
			
			swprintf(text,512,L"%.2f", m_value[i].time);
			if ( i == m_selectTimeID )
				graphics->setTextColor( uiColor(0x0000ff) );
			else
				graphics->setTextColor( uiColor(0xffffff) );

			graphics->drawText( x1, 0, text );

			// draw line x
			graphics->selectObject(&penX);
			graphics->drawLine(x0, y0, x1, y1);
			
			// draw line y
			y0 = getY( m_value[i-1].y );
			y1 = getY( m_value[i].y );
			graphics->selectObject(&penY);
			graphics->drawLine(x0, y0, x1, y1);

			// draw line z
			y0 = getY( m_value[i-1].z );
			y1 = getY( m_value[i].z );
			graphics->selectObject(&penZ);
			graphics->drawLine(x0, y0, x1, y1);
		}
		
		for ( int i = 0; i < len; i++ )
		{
			int r = 4;
			int x1 = getX( m_value[i].time );									
			int y1 = getY( m_value[i].x );					

			// draw rectX
			graphics->selectObject(&penX);			
			graphics->drawRectangle( x1-r,y1-r,x1+r,y1+r );
			
			// draw rectY
			y1 = getY( m_value[i].y );
			graphics->selectObject(&penY);
			graphics->drawRectangle( x1-r,y1-r,x1+r,y1+r );

			// draw rectZ
			y1 = getY( m_value[i].z );
			graphics->selectObject(&penZ);
			graphics->drawRectangle( x1-r,y1-r,x1+r,y1+r );
		}

		graphics->selectObject(&penX);
	
		// paint current time
		uiPen penTime(1, PS_SOLID, uiColor(0x00FFFF));

		if ( m_selectTimeID == -1 )
		{
			int xTime = getX( m_currentTime );
			graphics->selectObject(&penTime);
			graphics->drawLine( xTime, 0, xTime, nHeight );
		}
		else
		{
			int xTime = getX( m_value[m_selectTimeID].time );
			graphics->selectObject(&penTime);
			graphics->drawLine( xTime, 0, xTime, nHeight );
		}

	}	

	pG->swapBuffer(0,0,nWidth, nHeight, graphics, 0,0,nWidth,nHeight, SRCCOPY);
	graphics->releaseGraphics();	
}
Exemple #10
0
LRESULT toolbarCommand(HWND viewerWnd, HWND toolbar, int id)
{
  int oldWid = getClientWidth();
  int oldHyt = getClientHeight();

  //This function is completely stupid and
  //unextendable... (TODO:)
  switch(id)
  {
    case TOOLBAR_OPEN:
      SendMessage(viewerWnd, WM_CHAR, 'O', 0);
      break;
    case TOOLBAR_SAVE:
      SendMessage(viewerWnd, WM_CHAR, 'S', 0);
      break;
    case TOOLBAR_DELETE:
      SendMessage(viewerWnd, WM_KEYDOWN, VK_DELETE, 0);
      break;
    case TOOLBAR_RENAME:
      SendMessage(viewerWnd, WM_KEYDOWN, VK_F2, 0);
      break;

    case TOOLBAR_PREV_IMAGE:
      SendMessage(viewerWnd, WM_CHAR, '\b', 0);
      break;
    case TOOLBAR_NEXT_IMAGE:
      SendMessage(viewerWnd, WM_CHAR, ' ', 0);
      break;

    case TOOLBAR_ZOOM_IN:
      SendMessage(viewerWnd, WM_CHAR, '+', 0);
      break;
    case TOOLBAR_ZOOM_OUT:
      SendMessage(viewerWnd, WM_CHAR, '-', 0);
      break;
    case TOOLBAR_ZOOM_100:
      SendMessage(viewerWnd, WM_CHAR, '/', 0);
      break;
    case TOOLBAR_ZOOM_FIT:
      SendMessage(viewerWnd, WM_CHAR, '*', 0);
      break;
    case TOOLBAR_ZOOM_LOCK:
      SendMessage(viewerWnd, WM_CHAR, 'L', 0);
      break;
    case TOOLBAR_ROTATE_LEFT:
      SendMessage(viewerWnd, WM_CHAR, 'Q', 0);
      break;
    case TOOLBAR_ROTATE_RIGHT:
      SendMessage(viewerWnd, WM_CHAR, 'W', 0);
      break;

    case TOOLBAR_COPY:
      SendMessage(viewerWnd, WM_CHAR, 3, 0);
      break;
    case TOOLBAR_PASTE:
      SendMessage(viewerWnd, WM_CHAR, 22, 0);
      break;

    case TOOLBAR_ALPHA:
      SendMessage(viewerWnd, WM_CHAR, 'A', 0);
      break;
    case TOOLBAR_BLEND:
      SendMessage(viewerWnd, WM_CHAR, 'B', 0);
      break;

    case TOOLBAR_TILE_VIEW:
      SendMessage(viewerWnd, WM_CHAR, 'M', 0);
      break;
    case TOOLBAR_CUBEMAP_VIEW:
      SendMessage(viewerWnd, WM_CHAR, 'C', 0);
      break;

    case TOOLBAR_PREV_LAYER:
      SendMessage(viewerWnd, WM_KEYDOWN, VK_PRIOR, 0);
      break;
    case TOOLBAR_NEXT_LAYER:
      SendMessage(viewerWnd, WM_KEYDOWN, VK_NEXT, 0);
      break;
    case TOOLBAR_NEXT_MIPMAP:
      SendMessage(viewerWnd, WM_KEYDOWN, VK_RIGHT, 0);
      break;
    case TOOLBAR_PREV_MIPMAP:
      SendMessage(viewerWnd, WM_KEYDOWN, VK_LEFT, 0);
      break;
    case TOOLBAR_NEXT_SLICE:
      SendMessage(viewerWnd, WM_KEYDOWN, VK_DOWN, 0);
      break;
    case TOOLBAR_PREV_SLICE:
      SendMessage(viewerWnd, WM_KEYDOWN, VK_UP, 0);
      break;

    case TOOLBAR_OPTIONS:
      //show register file types dialog until
      //a "real" options dialog is implemented
      SendMessage(viewerWnd, WM_CHAR, 'R', 0);
      break;
    case TOOLBAR_ALWAYS_ON_TOP:
      SendMessage(viewerWnd, WM_CHAR, 'T', 0);
      break;
    case TOOLBAR_LOAD_TIMES:
      SendMessage(viewerWnd, WM_CHAR, 'D', 0);
      break;
    case TOOLBAR_HELP:
      SendMessage(viewerWnd, WM_CHAR, 'H', 0);
      break;
  }

  //keep cursor in icons that change window size
  if(getClientWidth() != oldWid || getClientHeight() != oldHyt)
  {
    int index = id - TOOLBAR_FIRST_ICON;
    RECT r;
    if(SendMessage(toolbar, TB_GETITEMRECT, index, (LPARAM)&r) == TRUE)
    {
      POINT p = { (r.left + r.right)/2, (r.top + r.bottom)/2 };
      ClientToScreen(toolbar, &p);

      int screenWid = GetSystemMetrics(SM_CXSCREEN);
      int screenHyt = GetSystemMetrics(SM_CYSCREEN);


      mouse_event(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE,
        (p.x*65535)/screenWid, (p.y*65535)/screenHyt, //dx, dy are normalized to [0, 65535]
        0, 0);
    }
  }

  return 0;
}
Exemple #11
0
PrefsDialog::PrefsDialog( Window *frame, Window *parent ) :
  Dialog( frame, parent, Strings::get( 168 ),
          AWindow::CENTER | AWindow::ISMODAL | AWindow::ADJUSTSIZE,
          0, 0, 500, 365 )
{
  char *namestr = "PrefsDialog";
  name = new char[strlen(namestr)+1];
  strcpy( name, namestr );

  getGraphics()->setDialogFont();

  int margin = 10, fontHeight = Graphics::dialogDesignFontHeight,
      yStart = getClientHeight() - fontHeight*2 - 20,
      interSpace = fontHeight + fontHeight / 2;

  prevUseBigFont = AGraphics::useBigFont;

  Notebook *notebook =
	  new Notebook( this, 0, 50, getClientWidth(), getClientHeight() - 50, 
		              Color::BKGR, 0 );

	asciiDialog = new AsciiDialog( notebook, notebook );
	ascii2Dialog = new Ascii2Dialog( notebook, notebook );
	hexDialog = new HexDialog( notebook, notebook );
	editorDialog = new EditorDialog( notebook, notebook );
	displayDialog = new DisplayDialog( notebook, notebook );
	miscDialog = new MiscDialog( notebook, notebook );

	notebook->add( editorDialog, Strings::get(188) );
	notebook->add( displayDialog, Strings::get(190) );
	notebook->add( asciiDialog, Strings::get(166) );
	notebook->add( ascii2Dialog, Strings::get(209) );
	notebook->add( hexDialog, Strings::get(179) );
	notebook->add( miscDialog, Strings::get(196) );

  OKButton = new Button( this, Strings::get(8), AWindow::ISDEFAULT|ISTABSTOP,
                             10, 10, 70, 30 );
  OKButton->setYMove( FOLLOW );

  cancelButton = new Button( this, Strings::get(9), ISTABSTOP, 90, 10, 70, 30 );
  cancelButton->setYMove( FOLLOW );

	setControlsVisible();
  notebook->setTab( 0 );

  OKButton->addButtonListener( this );
  cancelButton->addButtonListener( this );

  adjustForFontSize();

  // Save/restore window position

  initSize();

  int x = getX(), y = getY(), width = getWidth(), height = getHeight();
  WinProperties::retrieveProperty( name, x, y, width, height );

  setSize( width, height );
  center( x, y );
  setPos( x, y );
}
Exemple #12
0
HexDialog::HexDialog( Window *frame, Window *parent ) :
  Dialog( frame, parent, "",
          NOTITLE,
          0, 0, frame->getClientWidth(), frame->getClientHeight() - Notebook::getTabInset() )
{
  getGraphics()->setDialogFont();

  int margin = 10, fontHeight = Graphics::dialogDesignFontHeight,
      yStart = getClientHeight() - fontHeight,
      interSpace = fontHeight + fontHeight / 2;

  int editBoxHeight = EntryField::getInset() * 2 + fontHeight + 2;
  int editBoxInterSpace = editBoxHeight + fontHeight / 3,
      labelHeight = fontHeight + fontHeight / 3;

	int top = yStart;

  yStart -= fontHeight * 2 + fontHeight / 2;

	int top2 = yStart;

	Label *lbl = new Label( this, Label::LEFT, Strings::get(129), 20,
                    yStart, 50, labelHeight );

	fontCombo = new SComboBox( this, ISTABSTOP|SComboBox::STATIC, 20, yStart,
                            240, editBoxHeight, 100 );

  int comboHeight = fontCombo->getEditBoxHeight();
  yStart -= comboHeight + comboHeight / 2;
  fontCombo->setPos( fontCombo->getX(), yStart);

	yStart = top2;

	lbl = new Label( this, Label::LEFT, Strings::get(130), 270,
                    yStart, 50, labelHeight );

  yStart -= comboHeight + comboHeight / 2;

	sizeCombo = new SComboBox( this, ISTABSTOP|NUMERIC, 270, yStart,
                            	      80, editBoxHeight, 100 );
  sizeCombo->setMaxLength( 5 );

  yStart -= fontHeight*2;

  bitmapFontsCheck = new CheckBox( this, Strings::get(167),
                                   ISTABSTOP, 20, yStart, 150,
                                   fontHeight*2 );

  yStart -= fontHeight / 2;

  GroupBox *gBox = new GroupBox( this, Strings::get(128), 0, 10, yStart,
                                 360, top - yStart );

  yStart -= fontHeight / 2;

  top = yStart;

	fontPreviewWindow = new FontPreviewWindow( this, width - 220, (top-10-70) / 2, 200, 70 );
  fontPreviewWindow->setWMove( FOLLOW );
  fontPreviewWindow->setHMove( FOLLOW );

	if( Settings::hexFont == NULL )
	{
		Settings::hexFont = new char[strlen(Graphics::getHexEditorFontName())+1];
		strcpy( Settings::hexFont, Graphics::getHexEditorFontName());
		Settings::hexFontSizeP = Graphics::getHexEditorFontSize();
	}

	fontPreviewWindow->selectFont( getGraphics()->getFontFromName( Settings::hexFont, 0 ), 
	                               -1, -1, Settings::hexFontSizeP );


  yStart -= fontHeight * 3;

  numericInfoCheck = new CheckBox( this, Strings::get(231), ISTABSTOP, 20, yStart, 150, fontHeight * 2 );

  yStart -= interSpace;

  linesHexCheck = new CheckBox( this, Strings::get(246), ISTABSTOP, 20, yStart, width-280, fontHeight * 2 );

  yStart -= interSpace;

  hideAscii32Check = new CheckBox( this, Strings::get(254), ISTABSTOP, 20, yStart, width-280, fontHeight * 2 );

	yStart -= fontHeight / 2;

  gBox = new GroupBox( this, Strings::get(232), 0, 10, yStart, width-260, top - yStart );

	// Fill in fonts

	char numstr[30];
	int i;

	FontList *fonts = getGraphics()->getFonts();

	for( i = 0; i < fonts->fonts; i++ )
		if( fonts->font[i].monoSpaced )
			fontCombo->addItem( fonts->font[i].name );

	fontCombo->addSelectionListener(this);

  if( Settings::hexFontSizeP != -1 )
		sprintf( numstr, "%d", Settings::hexFontSizeP );
	else
		sprintf( numstr, "%dx%d", Settings::hexFontSizeX, 
             Settings::hexFontSizeY );

	sizeCombo->addSelectionListener(this);

	fontCombo->setText( Settings::hexFont  );

	sizeCombo->setText( numstr );

  fontCombo->setFocus();

  numericInfoCheck->check( Settings::showBytesInfo );
  linesHexCheck->check( Settings::linesInHex );
  hideAscii32Check->check( Settings::hideAscii32 );

	bitmapFontsCheck->addButtonListener(this);

	updateControlPos( NULL );

	setControlsVisible();		
}
Exemple #13
0
AsciiDialog::AsciiDialog( Window *frame, Window *parent ) :
  Dialog( frame, parent, "",
          NOTITLE,
          0, 0, frame->getClientWidth(), frame->getClientHeight() - Notebook::getTabInset() )
{
  getGraphics()->setDialogFont();

  int margin = 10, fontHeight = Graphics::dialogDesignFontHeight,
      yStart = getClientHeight() - fontHeight,
      interSpace = fontHeight + fontHeight / 2,
      labelHeight = fontHeight + fontHeight / 3;

  int editBoxHeight = EntryField::getInset() * 2 + fontHeight + 2;
  int editBoxInterSpace = editBoxHeight + fontHeight / 3;

	int top = yStart;

  yStart -= fontHeight * 2 + fontHeight / 2;

	int top2 = yStart;

	Label *lbl = new Label( this, Label::LEFT, Strings::get(129), 20,
                    yStart, 50, labelHeight );

	fontCombo = new SComboBox( this, ISTABSTOP|SComboBox::STATIC, 20, yStart,
                            240, editBoxHeight, 100 );

  int comboHeight = fontCombo->getEditBoxHeight();
  yStart -= comboHeight + comboHeight / 2;
  fontCombo->setPos( fontCombo->getX(), yStart);
  //lbl->setSize( lbl->getWidth(), comboHeight);
  //lbl->setPos( lbl->getX(), yStart);

	yStart = top2;

	lbl = new Label( this, Label::LEFT, Strings::get(130), 270,
                    yStart, 50, labelHeight );

  yStart -= comboHeight + comboHeight / 2;

	sizeCombo = new SComboBox( this, ISTABSTOP|NUMERIC, 270, yStart,
                            	      80, editBoxHeight, 100 );
  sizeCombo->setMaxLength( 5 );
  yStart -= fontHeight*2;

  fixedWidthOnlyCheck  = new CheckBox( this, Strings::get(131),
                                       ISTABSTOP, 20, yStart, 150,
                                       fontHeight*2 );

  bitmapFontsCheck  = new CheckBox( this, Strings::get(167),
                                    ISTABSTOP, 190, yStart, 150,
                                    fontHeight*2 );

  yStart -= fontHeight / 2;

  GroupBox *gBox = new GroupBox( this, Strings::get(128), 0, 10, yStart,
                                 360, top - yStart );

  yStart -= fontHeight / 2;

  top = yStart;

  yStart -= fontHeight * 2 + 15;

	lbl = new Label( this, Label::RIGHT, Strings::get(171), 20,
                    yStart, 90, labelHeight );

	textItemCombo = new SComboBox( this, ISTABSTOP|SComboBox::STATIC, 120, yStart,
                            	      width - 380, editBoxHeight, 100 );

  yStart -= interSpace;

  fgButton = new RadioButton( this, Strings::get(169),
                              NEWGROUP | ISTABSTOP, 20, yStart, 100,
                              interSpace );

  bgButton = new RadioButton( this, Strings::get(170),
                              INGROUP, 130, yStart, 100,
                              interSpace );


  yStart -= fontHeight/4 + 60;

	colorSet = new ValueSet( this, ISTABSTOP, 20, yStart, width - 280, fontHeight * 3.5, 10, 2, ValueSet::RGBCOLOR );

	yStart -= fontHeight;

  gBox = new GroupBox( this, Strings::get(128), 0, 10, yStart, width-260, top - yStart );

	colors[0] = Color::BLACK;
	colors[1] = Color::GRAY;
	colors[2] = Color::DARKRED;
	colors[3] = Color::BROWN;
	colors[4] = Color::DARKGREEN;
	colors[5] = Color::DARKCYAN;
	colors[6] = Color::DARKBLUE;
	colors[7] = Color::DARKPINK;
	colors[8] = Color::LIGHT;
	colors[9] = Color::SHADOW;
	colors[10] = Color::WHITE;
	colors[11] = Color::LIGHTGRAY;
	colors[12] = Color::RED;
	colors[13] = Color::YELLOW;
	colors[14] = Color::GREEN;
	colors[15] = Color::CYAN;
	colors[16] = Color::BLUE;
	colors[17] = Color::PINK;
	colors[18] = Color::BKGR;
	colors[19] = Color::DEFAULT;

	for( int yy = 0; yy < 2; yy++ )
		for( int xx = 0; xx < 10; xx++ )
			colorSet->setColor( xx, yy, colors[yy*10+xx] );

	colorSet->setVisible(TRUE);

	fontPreviewWindow = new FontPreviewWindow( this, width - 220, (top-10-70) / 2, 200, 70 );
  fontPreviewWindow->setWMove( FOLLOW );
  fontPreviewWindow->setHMove( FOLLOW );

	if( Settings::asciiFont == NULL )
	{
		Settings::asciiFont = new char[strlen(Graphics::getEditorFontName())+1];
		strcpy( Settings::asciiFont, Graphics::getEditorFontName());
		Settings::asciiFontSizeP = Graphics::getEditorFontSize();
	}

	fontPreviewWindow->selectFont( getGraphics()->getFontFromName( Settings::asciiFont, 0 ), 
	                               -1, -1, Settings::asciiFontSizeP );

	// Fill in fonts

	char numstr[30];
	int i;

	FontList *fonts = getGraphics()->getFonts();

	for( i = 0; i < fonts->fonts; i++ )
		if( (Settings::asciiFixedWidthOnly && fonts->font[i].monoSpaced) || 
				!Settings::asciiFixedWidthOnly  )
			fontCombo->addItem( fonts->font[i].name );

	fontCombo->addSelectionListener(this);

  if( Settings::asciiFontSizeP != -1 )
		sprintf( numstr, "%d", Settings::asciiFontSizeP );
	else
		sprintf( numstr, "%dx%d", Settings::asciiFontSizeX, 
             Settings::asciiFontSizeY );

	sizeCombo->addSelectionListener(this);

	if( Settings::asciiFixedWidthOnly )
		fixedWidthOnlyCheck->check(TRUE);	

	textItemCombo->addItem( Strings::get( 172 ) );
	textItemCombo->addItem( Strings::get( 173 ) );
	textItemCombo->addItem( Strings::get( 174 ) );
  textItemCombo->addItem( Strings::get( 214 ) );
  textItemCombo->addItem( Strings::get( 215 ) );
  textItemCombo->setText( Strings::get( 172 ) );

	textItemCombo->addSelectionListener( this );

	fontCombo->setText( Settings::asciiFont  );

	textFg = Settings::textFg;
	textBg = Settings::textBg;
	markFg = Settings::markFg;
	markBg = Settings::markBg;
	hiliteFg = Settings::hiliteFg;
	hiliteBg = Settings::hiliteBg;
	markerFg = Settings::markerFg;
	markerBg = Settings::markerBg;
	leftMarginFg = Settings::leftMarginFg;
	leftMarginBg = Settings::leftMarginBg;

  currentColorSet = -1;
  currentCp = 0;

  setColor( textFg );

	fgButton->check(TRUE);

	sizeCombo->setText( numstr );

  fontCombo->setFocus();

	fixedWidthOnlyCheck->addButtonListener(this);
	bitmapFontsCheck->addButtonListener(this);
	fgButton->addButtonListener(this);
	bgButton->addButtonListener(this);
	colorSet->addSelectionListener( this );
	
	updateControlPos( NULL );

	setControlsVisible();		
}
Exemple #14
0
MiscDialog::MiscDialog( Window *frame, Window *parent ) :
  Dialog( frame, parent, "",
          NOTITLE,
          0, 0, frame->getClientWidth(), frame->getClientHeight() - Notebook::getTabInset() )
{
  getGraphics()->setDialogFont();

  int margin = 10, fontHeight = fontHeight = Graphics::dialogDesignFontHeight,
      yStart = getClientHeight() - fontHeight,
      interSpace = fontHeight + fontHeight / 2,
      labelHeight = fontHeight + fontHeight / 3;

  int editBoxHeight = EntryField::getInset() * 2 + fontHeight + 2;

	int top = yStart;

	yStart -= fontHeight * 3;

  backupFilesCheck  = new CheckBox( this, Strings::get(198),
                                         NEWGROUP|ISTABSTOP, 20, yStart, 150,
                                         fontHeight*2 );

  useSystemFileDialogCheck  = new CheckBox( this, Strings::get(204),
                                         INGROUP, 180, yStart, 150,
                                         fontHeight*2 );

  yStart -= interSpace;

  useBigFontCheck  = new CheckBox( this, Strings::get(207),
                                         INGROUP, 20, yStart, 150,
                                         fontHeight*2 );

  autoCloseFrameWindowCheck  = new CheckBox( this, Strings::get(216),
                                         INGROUP, 180, yStart, 170,
                                         fontHeight*2 );

  yStart -= interSpace;

  showCommandBarCheck  = new CheckBox( this, Strings::get(220),
                                         INGROUP, 20, yStart, 150,
                                         fontHeight*2 );

  reuseExistingBufferCheck = new CheckBox( this, Strings::get(233),
                                         INGROUP, 180, yStart, 170,
                                         fontHeight*2 );

  yStart -= interSpace;

  showToolbarCheck = new CheckBox( this, Strings::get(253),
                                         INGROUP, 20, yStart, 170,
                                         fontHeight*2 );

  yStart -= interSpace;

  queryUnicodeCheck  = new CheckBox( this, Strings::get(240),
                                         INGROUP, 20, yStart, 250,
                                         fontHeight*2 );
  yStart -= fontHeight / 2;

  GroupBox *gBox = new GroupBox( this, Strings::get(186), 0, 10, yStart,
                                 360, top - yStart );

  yStart -= fontHeight / 2;

  top = yStart;

  yStart -= fontHeight * 3;

  autoSaveCheck  = new CheckBox( this, Strings::get(200),
                                         ISTABSTOP, 20, yStart, 150,
                                         fontHeight*2 );

  yStart -= interSpace;

	Label *lbl = new Label( this, Label::RIGHT, Strings::get(201), 20,
                   yStart, 150, labelHeight );

	autosaveDelayEntry = new EntryField( this, ISTABSTOP|BORDER, 180, yStart,
                               	    130, editBoxHeight );
	
  yStart -= fontHeight / 2;

  gBox = new GroupBox( this, Strings::get(199), 0, 
  										 10, yStart,
                       320, top - yStart );

	char str[100];

	if( Settings::backupFiles )
		backupFilesCheck->check( TRUE );

	if( Settings::autoSave )
		autoSaveCheck->check( TRUE );

	if( Settings::useSystemFileDialog )
		useSystemFileDialogCheck->check( TRUE );

  if( Settings::autoCloseFrameWindow )
		autoCloseFrameWindowCheck->check( TRUE );

  if( Settings::reuseExistingBuffer )
		reuseExistingBufferCheck->check( TRUE );

  if( Settings::showCommandBar )
    showCommandBarCheck->check( TRUE );
    
  if( Settings::showToolbar )
		showToolbarCheck->check( TRUE );

 	queryUnicodeCheck->check( Settings::queryIfUnicode );

	if( AGraphics::useBigFont )
		useBigFontCheck->check( TRUE );

	sprintf( str, "%d", Settings::autosaveDelay );
	autosaveDelayEntry->setText( str );

	backupFilesCheck->setFocus();

	setControlsVisible();
}
Exemple #15
0
DisplayDialog::DisplayDialog( Window *frame, Window *parent ) :
  Dialog( frame, parent, "",
          NOTITLE,
          0, 0, frame->getClientWidth(), frame->getClientHeight() - Notebook::getTabInset() )
{
  getGraphics()->setDialogFont();

  int margin = 10, fontHeight = fontHeight = Graphics::dialogDesignFontHeight,
      yStart = getClientHeight() - fontHeight,
      interSpace = fontHeight + fontHeight / 2,
      labelHeight = fontHeight + fontHeight / 3;

  int editBoxHeight = EntryField::getInset() * 2 + fontHeight + 2;

	int top = yStart;

	yStart -= fontHeight * 3;

  syntaxHighlightCheck  = new CheckBox( this, Strings::get(192),
                                         ISTABSTOP, 20, yStart, 150,
                                         fontHeight*2 );

  showSectionsCheck  = new CheckBox( this, Strings::get(248),
                                     ISTABSTOP, 180, yStart, 150,
                                     fontHeight*2 );

  yStart -= interSpace;

  autogenSectionsCheck  = new CheckBox( this, Strings::get(249),
                                         ISTABSTOP, 20, yStart, 250,
                                         fontHeight*2 );

  yStart -= fontHeight / 2;

  GroupBox *gBox = new GroupBox( this, Strings::get(191), 0, 10, yStart,
                                 360, top - yStart );

  yStart -= fontHeight / 2;

  top = yStart;

  yStart -= fontHeight * 3;

  showRightMarginCheck  = new CheckBox( this, Strings::get(194),
                                         ISTABSTOP, 20, yStart, 150,
                                         fontHeight*2 );

  yStart -= interSpace;

	Label *lbl = new Label( this, Label::RIGHT, Strings::get(195), 20,
                   yStart, 150, labelHeight );

	rightMarginEntry = new EntryField( this, ISTABSTOP|BORDER, 180, yStart,
                               	    130, editBoxHeight );
	
  yStart -= fontHeight / 2;

  gBox = new GroupBox( this, Strings::get(187), 0, 
  										 10, yStart,
                       320, top - yStart );

	char str[100];

	if( Settings::syntaxHighlight )
		syntaxHighlightCheck->check( TRUE );

	if( Settings::showRightMargin )
		showRightMarginCheck->check( TRUE );

	if( Settings::showSectionBrowser )
		showSectionsCheck->check( TRUE );

	if( Settings::autogenerateSections )
		autogenSectionsCheck->check( TRUE );

	sprintf( str, "%d", Settings::rightMargin );
	rightMarginEntry->setText( str );

	syntaxHighlightCheck->setFocus();

	setControlsVisible();		
}
Exemple #16
0
	void D3D12Render::loadPipeline()
	{
		HRESULT res;
#ifdef _DEBUG
		//Enable the D3D12 debug layer
		ComPtr<ID3D12Debug> pDebugController;
		if (SUCCEEDED(D3D12GetDebugInterface(IID_PPV_ARGS(&pDebugController))))
		{
			pDebugController->EnableDebugLayer();
		}
#endif

		ComPtr<IDXGIFactory4> pFactory;
		CreateDXGIFactory1(IID_PPV_ARGS(&pFactory));

		bool UseWarpDevice = false;

		if (UseWarpDevice)
		{
			ComPtr<IDXGIAdapter> pWarpAdapter;
			res = pFactory->EnumWarpAdapter(IID_PPV_ARGS(&pWarpAdapter));
			assert(res == S_OK);
			res = D3D12CreateDevice(pWarpAdapter.Get(), D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&m_pD3D12Device));
			assert(res == S_OK);
		}
		else
		{
			res = D3D12CreateDevice(nullptr, D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&m_pD3D12Device));
		    assert(res == S_OK);
		}

		///////////////////////	//Describe and Create the command queue//////////////////////////////////////////////

		D3D12_COMMAND_QUEUE_DESC queueDesc ={};
		queueDesc.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE;
		queueDesc.Type  = D3D12_COMMAND_LIST_TYPE_DIRECT;
		res =  m_pD3D12Device->CreateCommandQueue(&queueDesc, IID_PPV_ARGS(&m_pCommandQueue));
		assert(res == S_OK);

		//Describe and Create the swap chain
		DXGI_SWAP_CHAIN_DESC swapChainDesc ={};
		swapChainDesc.BufferCount       = FrameCount;
		swapChainDesc.BufferDesc.Width  = getClientWidth();
		swapChainDesc.BufferDesc.Height = getClientHeight();
		swapChainDesc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
		swapChainDesc.BufferUsage       = DXGI_USAGE_RENDER_TARGET_OUTPUT;
		swapChainDesc.SwapEffect        = DXGI_SWAP_EFFECT_FLIP_DISCARD;
		swapChainDesc.OutputWindow      = getHwnd();
		swapChainDesc.SampleDesc.Count  = 1;
		swapChainDesc.Windowed          = TRUE;

		ComPtr<IDXGISwapChain> pSwapChain;
		res =  pFactory->CreateSwapChain(
			m_pCommandQueue.Get(),		// Swap chain needs the queue so that it can force a flush on it.
			&swapChainDesc,
			&pSwapChain
			);
		assert(res == S_OK);

		res = pSwapChain.As(&m_pSwapChain);
		assert(res == S_OK);

		m_frameIndex = m_pSwapChain->GetCurrentBackBufferIndex();

		///////////////////////// Create Decriptor heaps /////////////////////////////////////////////


		{
			D3D12_DESCRIPTOR_HEAP_DESC rtvHeapDesc ={};
			rtvHeapDesc.NumDescriptors = FrameCount;
			rtvHeapDesc.Type           = D3D12_DESCRIPTOR_HEAP_TYPE_RTV;
			rtvHeapDesc.Flags          = D3D12_DESCRIPTOR_HEAP_FLAG_NONE;

			res =  m_pD3D12Device->CreateDescriptorHeap(&rtvHeapDesc, IID_PPV_ARGS(&m_pRTVHeap));
			assert(res == S_OK);
			m_rtvDescSize = m_pD3D12Device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_RTV);

		}

		//Create frame resources
		{
			CD3DX12_CPU_DESCRIPTOR_HANDLE rtvHandle(m_pRTVHeap->GetCPUDescriptorHandleForHeapStart());

			// Create a RTV for each frame.
			for (UINT n = 0; n < FrameCount; n++)
			{
				res =  m_pSwapChain->GetBuffer(n, IID_PPV_ARGS(&m_pRenderTargets[n]));
				assert(res == S_OK);
				m_pD3D12Device->CreateRenderTargetView(m_pRenderTargets[n].Get(), nullptr, rtvHandle);
				rtvHandle.Offset(1, m_rtvDescSize);
			}
		}
		//The command allocator is going to be used for allocating memory for the list of commands that we send to the GPU each frame to render graphics.
		res = m_pD3D12Device->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(&m_pCommandAllocator));
		assert(res == S_OK);
		res = m_pD3D12Device->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_BUNDLE, IID_PPV_ARGS(&m_pBundleAllocator));
		assert(res == S_OK);
	}
Exemple #17
0
EditorDialog::EditorDialog( Window *frame, Window *parent ) :
  Dialog( frame, parent, "",
          NOTITLE,
          0, 0, frame->getClientWidth(), frame->getClientHeight() - Notebook::getTabInset() )
{
  getGraphics()->setDialogFont();

  int margin = 10, fontHeight = Graphics::dialogDesignFontHeight,
      yStart = getClientHeight() - fontHeight,
      interSpace = fontHeight + fontHeight / 2;

  int editBoxHeight = EntryField::getInset() * 2 + fontHeight + 2;
  int editBoxInterSpace = editBoxHeight + fontHeight / 3,
      labelHeight = fontHeight + fontHeight / 3;

	int top = yStart;

	yStart -= fontHeight * 3;

  persistentBlocksCheck  = new CheckBox( this, Strings::get(180),
                                         NEWGROUP|ISTABSTOP, 20, yStart, 150,
                                         fontHeight*2 );

  useTabCheck  = new CheckBox( this, Strings::get(202),
                                         INGROUP, 180, yStart, 100,
                                         fontHeight*2 );

	yStart -= interSpace;

  optimalFillCheck  = new CheckBox( this, Strings::get(203),
                                         INGROUP, 20, yStart, 150,
                                         fontHeight*2 );

  virtualSpaceCheck  = new CheckBox( this, Strings::get(230),
                                         INGROUP, 180, yStart, 150,
                                         fontHeight*2 );

  yStart -= fontHeight / 2;

  GroupBox *gBox = new GroupBox( this, Strings::get(186), 0, 10, yStart,
                                 360, top - yStart );

  yStart -= fontHeight / 2;

  top = yStart;

  yStart -= fontHeight * 3;

	Label *lbl = new Label( this, Label::RIGHT, Strings::get(181), 20,
                   yStart, 150, labelHeight );

	tabSizeEntry = new EntryField( this, ISTABSTOP|NEWGROUP|BORDER|NUMERIC, 180, yStart,
                               	    50, editBoxHeight );
	
  yStart -= editBoxInterSpace;

	lbl = new Label( this, Label::RIGHT, Strings::get(183), 20,
                   yStart, 150, labelHeight );

	delimEntry = new EntryField( this, ISTABSTOP|BORDER, 180, yStart,
                               	    130, editBoxHeight );
	
  yStart -= editBoxInterSpace;

	lbl = new Label( this, Label::RIGHT, Strings::get(182), 20,
                   yStart, 150, labelHeight );

	maxUndoSizeEntry = new EntryField( this, ISTABSTOP|BORDER|NUMERIC, 180, yStart,
                               	    50, editBoxHeight );
	
  yStart -= fontHeight / 2;

  gBox = new GroupBox( this, Strings::get(187), 0, 
  										 10, yStart,
                       320, top - yStart );

  yStart -= fontHeight / 2;

  top = yStart;

  yStart -= fontHeight * 3;

  CRLFButton = new RadioButton( this, Strings::get(184),
                                            NEWGROUP|ISTABSTOP, 20, yStart, 70,
                                            fontHeight*2 );

  LFButton = new RadioButton( this, Strings::get(185),
                                            0, 100, yStart, 70,
                                            fontHeight*2 );
  yStart -= fontHeight / 2;

  gBox = new GroupBox( this, Strings::get(189), 0, 
  										 10, yStart,
                       180, top - yStart );

	char str[100];

	if( Settings::persistentBlocks )
		persistentBlocksCheck->check( TRUE );

	if( Settings::useTab )
		useTabCheck->check( TRUE );

	if( Settings::optimalFill )
		optimalFillCheck->check( TRUE );

	if( Settings::virtualSpace )
		virtualSpaceCheck->check( TRUE );

	sprintf( str, "%d", Settings::tabSize );
	tabSizeEntry->setText( str );

	char *delim = new char[strlen(Settings::standardDelim) * 2 + 1];

	int len = 0;

	for( int i = 0; i < strlen( Settings::standardDelim ); i++ )
	{
		if( Settings::standardDelim[i] == 0x9 )
		{
			delim[len++] = '\\';
			delim[len++] = 't';
		}
		else
		if( Settings::standardDelim[i] == '\\' )
		{
			delim[len++] = '\\';
			delim[len++] = '\\';
		}
		else
			delim[len++] = Settings::standardDelim[i];
	}

	delim[len] = 0;

	delimEntry->setText( delim );

	delete delim;

	sprintf( str, "%d", Settings::maxUndoSize / 1024 );
	maxUndoSizeEntry->setText( str );

	if( Settings::CRLF )
		CRLFButton->check(TRUE);
	else
		LFButton->check(TRUE);

	persistentBlocksCheck->setFocus();

	setControlsVisible();		
}