コード例 #1
0
ファイル: MarginView.cpp プロジェクト: mariuz/haiku
/**
 * MesssageReceived()
 *
 * Receive messages for the view
 *
 * @param BMessage* , the message being received
 * @return void
 */
void
MarginView::MessageReceived(BMessage *msg)
{
	switch (msg->what) {
		case CHANGE_PAGE_SIZE: {
				float w;
				float h;
				msg->FindFloat("width", &w);
				msg->FindFloat("height", &h);
				SetPageSize(w, h);
				UpdateView(MARGIN_CHANGED);
			}	break;

		case FLIP_PAGE: {
				BPoint p = PageSize();
				SetPageSize(p.y, p.x);
				UpdateView(MARGIN_CHANGED);
			}	break;

		case MARGIN_CHANGED:
			UpdateView(MARGIN_CHANGED);
			break;

		case TOP_MARGIN_CHANGED:
			UpdateView(TOP_MARGIN_CHANGED);
			break;

		case LEFT_MARGIN_CHANGED:
			UpdateView(LEFT_MARGIN_CHANGED);
			break;

		case RIGHT_MARGIN_CHANGED:
			UpdateView(RIGHT_MARGIN_CHANGED);
			break;

		case BOTTOM_MARGIN_CHANGED:
			UpdateView(BOTTOM_MARGIN_CHANGED);
			break;

		case MARGIN_UNIT_CHANGED: {
		 		int32 marginUnit;
		 		if (msg->FindInt32("marginUnit", &marginUnit) == B_OK)
					_SetMarginUnit((MarginUnit)marginUnit);
			}	break;

		default:
			BView::MessageReceived(msg);
			break;
	}
}
コード例 #2
0
ファイル: scroller.cpp プロジェクト: Tigerwhit4/Meridian59
//
/// Sets the XUnit and YUnit data members to TheXUnit and TheYUnit, respectively.
/// Updates XPage and YPage by calling SetPageSize.
//
void
TScroller::SetUnits(int xUnit, int yUnit)
{
    XUnit = xUnit;
    YUnit = yUnit;
    SetPageSize();
}
コード例 #3
0
ファイル: nuiRange.cpp プロジェクト: JamesLinus/nui3
bool nuiRange::FromString(const nglString& Value)
{
  double value=0,min=0,max=0,increment=0,pageincrement=0,pagesize=0,origin=0;
  long res;
  nglString str=Value;
  if (!str.GetLength() || str[0]!='[' || str[str.GetLength()-1]!=']')
    return false;
    
  str.DeleteLeft(1);
  str.DeleteRight(1);
  std::vector<nglString> vec;
  res = str.Tokenize(vec);
  
  if (vec.size() == 7)
  {
    value         = vec[0].GetCDouble();
    min           = vec[1].GetCDouble();
    max           = vec[2].GetCDouble();
    increment     = vec[3].GetCDouble();
    pageincrement = vec[4].GetCDouble();
    pagesize      = vec[5].GetCDouble();
    origin        = vec[6].GetCDouble();
    
    SetValue(value);
    SetRange(min,max);
    SetIncrement(increment);
    SetPageIncrement(pageincrement);
    SetPageSize(pagesize);
    SetOrigin(origin);
    return true;
  }
  return false;
}
コード例 #4
0
ファイル: codecext.c プロジェクト: kullo/smartsqlite
// Report the page size to the codec (address passed in sqlite3PagerSetCodec)
static void CodecSizeChange(void *pCodec, int pageSize, int nReserve)
{
    BOTANSQLITE_TRACE("CodecSizeChange");
    (void)nReserve;
    assert(pageSize >= 0);
    if (pCodec) SetPageSize(pCodec, (size_t)pageSize);
}
コード例 #5
0
void
PrinterAttributes::SetFromNode(DataNode *parentNode)
{
    if(parentNode == 0)
        return;

    DataNode *searchNode = parentNode->GetNode("PrinterAttributes");
    if(searchNode == 0)
        return;

    DataNode *node;
    if((node = searchNode->GetNode("printerName")) != 0)
        SetPrinterName(node->AsString());
    if((node = searchNode->GetNode("printProgram")) != 0)
        SetPrintProgram(node->AsString());
    if((node = searchNode->GetNode("documentName")) != 0)
        SetDocumentName(node->AsString());
    if((node = searchNode->GetNode("creator")) != 0)
        SetCreator(node->AsString());
    if((node = searchNode->GetNode("numCopies")) != 0)
        SetNumCopies(node->AsInt());
    if((node = searchNode->GetNode("portrait")) != 0)
        SetPortrait(node->AsBool());
    if((node = searchNode->GetNode("printColor")) != 0)
        SetPrintColor(node->AsBool());
    if((node = searchNode->GetNode("outputToFile")) != 0)
        SetOutputToFile(node->AsBool());
    if((node = searchNode->GetNode("outputToFileName")) != 0)
        SetOutputToFileName(node->AsString());
    if((node = searchNode->GetNode("pageSize")) != 0)
        SetPageSize(node->AsInt());
}
コード例 #6
0
WIZARD_FPLIB_TABLE::WIZARD_FPLIB_TABLE( wxWindow* aParent ) :
    WIZARD_FPLIB_TABLE_BASE( aParent ), m_welcomeDlg( m_pages[0] ),
    m_fileSelectDlg( m_pages[1] ), m_githubListDlg( m_pages[2] ),
    m_reviewDlg( m_pages[3] ), m_targetDlg( m_pages[4] ), m_selectedFilter( 0 )
{
    m_filePicker->SetFilter( getFilterString() );

    // Initialize default download dir
    wxString default_path;
    wxGetEnv( FP_LIB_TABLE::GlobalPathEnvVariableName(), &default_path );
    setDownloadDir( default_path );
    m_filePicker->SetPath( default_path );

    // Restore the Github url
    wxString githubUrl;

    wxConfigBase* cfg = Pgm().CommonSettings();
    cfg->Read( KICAD_FPLIBS_URL_KEY, &githubUrl );
    cfg->Read( KICAD_FPLIBS_LAST_DOWNLOAD_DIR, &m_lastGithubDownloadDirectory );


    if( !m_lastGithubDownloadDirectory.IsEmpty() )
    {
        setDownloadDir( m_lastGithubDownloadDirectory );
        m_filePicker->SetPath( m_lastGithubDownloadDirectory );
    } else {
        m_lastGithubDownloadDirectory = default_path;
    }

    if( githubUrl.IsEmpty() )
        githubUrl = wxT( "https://github.com/KiCad" );

    SetGithubURL( githubUrl );

    // Give the minimal size to the dialog, which allows displaying any page
    wxSize minsize;

    for( unsigned ii = 0; ii < m_pages.size(); ii++ )
    {
        wxSize size = m_pages[ii]->GetSizer()->CalcMin();
        minsize.x = std::max( minsize.x, size.x );
        minsize.y = std::max( minsize.y, size.y );
    }

    SetMinSize( minsize );
    SetPageSize( minsize );
    GetSizer()->SetSizeHints( this );
    Center();

    if( !m_radioAddGithub->GetValue() && !m_radioAddLocal->GetValue() )
        m_radioAddLocal->SetValue( true );

    setupDialogOrder();
    updateGithubControls();

    Connect( wxEVT_RADIOBUTTON, wxCommandEventHandler( WIZARD_FPLIB_TABLE::OnSourceCheck ), NULL, this );
    Connect( wxEVT_DIRCTRL_SELECTIONCHANGED, wxCommandEventHandler( WIZARD_FPLIB_TABLE::OnSelectFiles ), NULL, this );
    Connect( wxEVT_CHECKLISTBOX, wxCommandEventHandler( WIZARD_FPLIB_TABLE::OnCheckGithubList ), NULL, this );
}
コード例 #7
0
ファイル: Report.cpp プロジェクト: ultimatepp/mirror
bool Report::ChooseDefaultPrinter(const char *jobname)
{
	printerjob.Create();
	printerjob->Name(jobname);
	Size sz = printerjob->GetDraw().GetPageSize();
	if(sz.cx == 0 || sz.cy == 0)
		return false;
	SetPageSize(sz);
	return true;
}
コード例 #8
0
ファイル: MFCQuaRotor.cpp プロジェクト: dakyri/qua
void
MFCQuaRotor::PreSubclassWindow() 
{
	CSliderCtrl::PreSubclassWindow();

	EnableToolTips();
	SetRange(30, 329, FALSE);
	SetLineSize(3);
	SetPageSize(30);
}
コード例 #9
0
void CRoundSliderCtrl::PreSubclassWindow() 
{
	CSliderCtrl::PreSubclassWindow();

	SetRange(0, 359, FALSE);
	SetLineSize(1);
	SetPageSize(10);

	Init();
}
コード例 #10
0
ファイル: Report.cpp プロジェクト: ultimatepp/mirror
bool Report::ChoosePrinter(const char *jobname)
{
	printerjob.Create();
	printerjob->Name(jobname);
	if(!printerjob->Execute()) {
		printerjob.Clear();
		return false;
	}
	SetPageSize(printerjob->GetDraw().GetPageSize());
	return true;
}
WIZARD_3DSHAPE_LIBS_DOWNLOADER::WIZARD_3DSHAPE_LIBS_DOWNLOADER( wxWindow* aParent ) :
    WIZARD_3DSHAPE_LIBS_DOWNLOADER_BASE( aParent )
{
    m_welcomeDlg = m_pages[0];
    m_githubListDlg = m_pages[1];
    m_reviewDlg = m_pages[2];

    // Initialize default download dir (local target folder of 3D shapes libs)
    wxString default_path;
    wxGetEnv( KISYS3DMOD, &default_path );

    wxConfigBase* cfg = Pgm().CommonSettings();
    wxString tmp;
    cfg->Read( KICAD_3DLIBS_LAST_DOWNLOAD_DIR, &tmp, default_path );
    setDownloadDir( tmp );

    // Restore the Github 3D shapes libs url
    wxString githubUrl;
    cfg->Read( KICAD_3DLIBS_URL_KEY, &githubUrl );

    if( githubUrl.IsEmpty() )
        githubUrl = DEFAULT_GITHUB_3DSHAPES_LIBS_URL;

    SetGithubURL( githubUrl );


    // Give the minimal size to the dialog, which allows displaying any page
    wxSize minsize;

    for( unsigned ii = 0; ii < m_pages.size(); ii++ )
    {
        wxSize size = m_pages[ii]->GetSizer()->CalcMin();
        minsize.x = std::max( minsize.x, size.x );
        minsize.y = std::max( minsize.y, size.y );
    }

    SetMinSize( minsize );
    SetPageSize( minsize );
    GetSizer()->SetSizeHints( this );
    Center();

    setupDialogOrder();
    updateGithubControls();

    // When starting m_textCtrlGithubURL has the focus, and the text is selected,
    // and not fully visible.
    // Forcing deselection does not work, at least on W7 with wxWidgets 3.0.2
    // So (and also because m_textCtrlGithubURL and m_downloadDir are rarely modified
    // the focus is given to an other widget.
    m_hyperlinkGithubKicad->SetFocus();

    Connect( wxEVT_RADIOBUTTON, wxCommandEventHandler( WIZARD_3DSHAPE_LIBS_DOWNLOADER::OnSourceCheck ), NULL, this );
    Connect( wxEVT_CHECKLISTBOX, wxCommandEventHandler( WIZARD_3DSHAPE_LIBS_DOWNLOADER::OnCheckGithubList ), NULL, this );
}
コード例 #12
0
ファイル: VolumeCtrl.cpp プロジェクト: Strongc/playasa
bool CVolumeCtrl::Create(CWnd* pParentWnd)
{
	if(!CSliderCtrl::Create(WS_CHILD|WS_VISIBLE|TBS_NOTICKS|TBS_HORZ, CRect(0,0,0,0), pParentWnd, IDC_SLIDER1))
		return(false);

	SetRange(0, 120);
	SetPosInternal(AfxGetCurrentSettings().nVolume);
	SetPageSize(8);
	SetLineSize(0);

	return(true);
}
コード例 #13
0
BOOL CRoundSliderCtrl::PreCreateWindow(CREATESTRUCT& cs) 
{
	if(!CSliderCtrl::PreCreateWindow(cs)) return FALSE;

	SetRange(0, 359, FALSE);
	SetLineSize(3);
	SetPageSize(10);

	Init();

	return TRUE;
}
コード例 #14
0
void XGScrollView::DoSizeView()
{
	XRect r = GetContentRect();
	int step = fPixel;
	if (step < 1) step = 1;
	long xval = (r.right - r.left - (step >> 1)) / step;
	if (xval < 1) xval = 1;
	long yval = (r.bottom - r.top - (step >> 1)) / step;
	if (yval < 1) yval = 1;
	SetPageSize(xval,yval);
	
	XGView::DoSizeView();
}
コード例 #15
0
ファイル: VolumeCtrl.cpp プロジェクト: Murder66/mpc-hc-master
bool CVolumeCtrl::Create(CWnd* pParentWnd)
{
    if (!CSliderCtrl::Create(WS_CHILD | WS_VISIBLE | TBS_NOTICKS | TBS_HORZ | TBS_TOOLTIPS, CRect(0, 0, 0, 0), pParentWnd, IDC_SLIDER1)) {
        return false;
    }

    const CAppSettings& s = AfxGetAppSettings();
    EnableToolTips(TRUE);
    SetRange(0, 100);
    SetPos(s.nVolume);
    SetPageSize(s.nVolumeStep);
    SetLineSize(0);

    return true;
}
コード例 #16
0
ファイル: TinyCadRegistry.cpp プロジェクト: soloveyhappy/tiny
//-------------------------------------------------------------------------
//-- Write the initial data to the registry
void CTinyCadRegistry::CreateDefaultEntries()
{
	TRACE("Virgin install detected:  CTinyCadRegistry::CreateDefaultEntries() is creating the very first registry entries for Tinycad\n");

	// Save the page size setup
	SetPageSize(CSize(297 * PIXELSPERMM, 210 * PIXELSPERMM));
	SetMaximize(false);

	// Search the default library directory for libraries
	for (int l = 0; l < 3; l++)
	{
		CString sSearch = CTinyCadApp::GetDefaultLibraryDir() /* + "library\\" */;

		if (l == 0)
		{
			sSearch += "*.idx";
		}
		else if (l == 1)
		{
			sSearch += "*.mdb";
		}
		else
		{
			sSearch += "*.TCLib";
		}

		FindFile theFind(sSearch);

		if (theFind.Success())
		{
			CString Libraries = "";

			do
			{
				// Add this library to the list of libraries in use
				if (Libraries != "") Libraries += ",";
				Libraries += CTinyCadApp::GetDefaultLibraryDir() /* + "library\\" */ + theFind.GetName();
				// Remove the extension (of .idx or .mdb or .TCLib)
				Libraries = Libraries.Left(Libraries.ReverseFind('.'));
			} while (theFind.FindNext());

			super::Set("Libraries", Libraries);
		}
	}

	// Finally place the association of this file and the design type
	super::Associate(".dsn", "TinyCAD design", "TinyCAD");
}
コード例 #17
0
ファイル: cprint.c プロジェクト: sharkcz/xtrkcad
static void PrintMaxPageSize( void )
/*
 * Called when print:maxPageSize button is clicked.
 * Set print page size to maximum
 * (depending on paper size, scale and orientation)
 */
{
	DrawPrintGrid();
	SetPageSize( TRUE );
	currPrintGrid.size = maxPageSize;
	newPrintGrid = currPrintGrid;
	ParamLoadControls( &printPG );
	ChangeDim();
	DrawPrintGrid();
	wShow( printWin);
}
コード例 #18
0
ファイル: pluginwizard.cpp プロジェクト: RVictor/EmbeddedLite
bool PluginWizard::Run(NewPluginData &data)
{
	wxSize sz1 = m_page1->GetSizer()->CalcMin();
	wxSize sz2 = m_page2->GetSizer()->CalcMin();

	wxSize maxSize = sz1;
	if(maxSize.GetWidth() < sz2.GetWidth()) maxSize = sz2;
	if(maxSize.GetWidth() < 400){
		maxSize.SetWidth(400);
	}
	
	SetPageSize(maxSize);
	if(RunWizard(m_page1)){
		data.SetPluginName(((PluginWizardPage1*) m_page1)->GetName());
		data.SetPluginDescription(((PluginWizardPage1*) m_page1)->GetDescription());
		data.SetProjectPath(((PluginWizardPage2*) m_page2)->GetProjectPath());
		data.SetCodelitePath(((PluginWizardPage2*) m_page2)->GetCodelitePath());
		return true;
	}
	return false;
}
コード例 #19
0
ファイル: Report.cpp プロジェクト: ultimatepp/mirror
void Report::Clear()
{
	SetPageSize(3968, 6074);
}
コード例 #20
0
ファイル: slider.cpp プロジェクト: Asmodean-/Ishiiruka
bool wxSlider::Create(wxWindow *parent,
                      wxWindowID id,
                      int value,
                      int minValue,
                      int maxValue,
                      const wxPoint& pos,
                      const wxSize& size,
                      long style,
                      const wxValidator& validator,
                      const wxString& name)
{
    wxCHECK_MSG( minValue < maxValue, false,
        wxT("Slider minimum must be strictly less than the maximum.") );

    // our styles are redundant: wxSL_LEFT/RIGHT imply wxSL_VERTICAL and
    // wxSL_TOP/BOTTOM imply wxSL_HORIZONTAL, but for backwards compatibility
    // reasons we can't really change it, instead try to infer the orientation
    // from the flags given to us here
    switch ( style & (wxSL_LEFT | wxSL_RIGHT | wxSL_TOP | wxSL_BOTTOM) )
    {
        case wxSL_LEFT:
        case wxSL_RIGHT:
            style |= wxSL_VERTICAL;
            break;

        case wxSL_TOP:
        case wxSL_BOTTOM:
            style |= wxSL_HORIZONTAL;
            break;

        case 0:
            // no specific direction, do we have at least the orientation?
            if ( !(style & (wxSL_HORIZONTAL | wxSL_VERTICAL)) )
            {
                // no, choose default
                style |= wxSL_BOTTOM | wxSL_HORIZONTAL;
            }
    };

    wxASSERT_MSG( !(style & wxSL_VERTICAL) || !(style & wxSL_HORIZONTAL),
                    wxT("incompatible slider direction and orientation") );


    // initialize everything
    if ( !CreateControl(parent, id, pos, size, style, validator, name) )
        return false;

    // ensure that we have correct values for GetLabelsSize()
    m_rangeMin = minValue;
    m_rangeMax = maxValue;

    // create the labels first, so that our DoGetBestSize() could take them
    // into account
    //
    // note that we could simply create 3 wxStaticTexts here but it could
    // result in some observable side effects at wx level (e.g. the parent of
    // wxSlider would have 3 more children than expected) and so we prefer not
    // to do it like this
    if ( m_windowStyle & wxSL_LABELS )
    {
        m_labels = new wxSubwindows(SliderLabel_Last);

        HWND hwndParent = GetHwndOf(parent);
        for ( size_t n = 0; n < SliderLabel_Last; n++ )
        {
            wxWindowIDRef lblid = NewControlId();

            HWND wnd = ::CreateWindow
                         (
                            wxT("STATIC"),
                            NULL,
                            WS_CHILD | WS_VISIBLE | SS_CENTER,
                            0, 0, 0, 0,
                            hwndParent,
                            (HMENU)wxUIntToPtr(lblid.GetValue()),
                            wxGetInstance(),
                            NULL
                         );

            m_labels->Set(n, wnd, lblid);
        }
        m_labels->SetFont(GetFont());
    }

    // now create the main control too
    if ( !MSWCreateControl(TRACKBAR_CLASS, wxEmptyString, pos, size) )
        return false;

    // and initialize everything
    SetRange(minValue, maxValue);
    SetValue(value);
    SetPageSize( wxMax(1, (maxValue - minValue)/10) );

    // we need to position the labels correctly if we have them and if
    // SetSize() hadn't been called before (when best size was determined by
    // MSWCreateControl()) as in this case they haven't been put in place yet
    if ( m_labels && size.x != wxDefaultCoord && size.y != wxDefaultCoord )
    {
        SetSize(size);
    }

    return true;
}
コード例 #21
0
ファイル: Report.cpp プロジェクト: ultimatepp/mirror
Report::Report(const Size &sz)
{
	mg.x = mg.y = Null;
	SetPageSize(sz);
}
コード例 #22
0
ファイル: cprint.c プロジェクト: sharkcz/xtrkcad
static STATUS_T CmdPrint(
		wAction_t action,
		coOrd pos )
/*
 * Print command:
 *
 * 3 Sub-states:
 *		Select - grid coordinates are computed and the selected page is marked.
 *		Move - grid base (currPrintGrid.orig) is moved.
 *		Rotate - grid base and angle is rotated about selected point.
 */
{
	STATUS_T rc = C_CONTINUE;
	static BOOL_T downShift;

	switch (action) {

	case C_START:
		if (!wPrintInit())
			return C_TERMINATE;
		printScale = iPrintScale;
		if (printWin == NULL) {
			rminScale_999.low = 1;
			if (printScale < rminScale_999.low)
				printScale = rminScale_999.low;
			print_d.scale = printScale;
			printWin = ParamCreateDialog( &printPG, MakeWindowTitle(_("Print")), _("Print"), DoPrintPrint, (paramActionCancelProc)Reset, TRUE, NULL, 0, PrintDlgUpdate );
		}
		wShow( printWin );
		SetPageSize( TRUE );
		if (currPrintGrid.size.x == 0.0) {
			currPrintGrid.size.x = maxPageSize.x;
			currPrintGrid.size.y = maxPageSize.y;
		}
		if (currPrintGrid.size.x >= maxPageSize.x)
			currPrintGrid.size.x = maxPageSize.x;
		if (currPrintGrid.size.y >= maxPageSize.y)
			currPrintGrid.size.y = maxPageSize.y;
		newPrintGrid = currPrintGrid;
		ParamLoadControls( &printPG );
		DrawPrintGrid();
		pageCount = 0;
LOG( log_print, 2, ( "Page size = %0.3f %0.3f\n", currPrintGrid.size.x, currPrintGrid.size.y ) )
		PrintChange( CHANGE_MAP|CHANGE_UNITS );
		ParamGroupRecord( &printPG );
		ParamLoadMessage( &printPG, I_PAGECNT, "0 pages" );
		ParamDialogOkActive( &printPG, FALSE );
		ChangeDim();
		InfoMessage( _("Select pages to print, or drag to move print grid") );
		downShift = FALSE;
		ParamControlActive( &printPG, I_RULER, currPrintGrid.angle == 0 );
		return C_CONTINUE;

	case C_DOWN:
		downShift = FALSE;
		if (MyGetKeyState()&WKEY_SHIFT) {
			newPrintGrid = currPrintGrid;
			rc = GridAction( C_DOWN, pos, &newPrintGrid.orig, &newPrintGrid.angle );
			downShift = TRUE;
		}
		return C_CONTINUE;

	case C_MOVE:
		if (downShift) {
			rc = GridAction( action, pos, &newPrintGrid.orig, &newPrintGrid.angle );
			ParamLoadControls( &printPG );
		}
		return C_CONTINUE;

	case C_UP:
		if (downShift) {
			rc = GridAction( action, pos, &newPrintGrid.orig, &newPrintGrid.angle );
			ParamLoadControls( &printPG );
			DrawPrintGrid();
			currPrintGrid = newPrintGrid;
			ChangeDim();
			DrawPrintGrid();
			downShift = FALSE;
		}
		return C_CONTINUE;

	case C_LCLICK:
		SelectPage( pos );
		return C_CONTINUE;

	case C_RDOWN:
		downShift = FALSE;
		if (MyGetKeyState()&WKEY_SHIFT) {
			newPrintGrid = currPrintGrid;
			rc = GridAction( action, pos, &newPrintGrid.orig, &newPrintGrid.angle );
			downShift = TRUE;
		}
		return rc;

	case C_RMOVE:
		if (downShift) {
			rc = GridAction( action, pos, &newPrintGrid.orig, &newPrintGrid.angle );
			ParamLoadControls( &printPG );
		}
		return rc;

	case C_RUP:
		if (downShift) {
			rc = GridAction( action, pos, &newPrintGrid.orig, &newPrintGrid.angle );
			ParamLoadControls( &printPG );
			DrawPrintGrid();
			currPrintGrid = newPrintGrid;
			ChangeDim();
			DrawPrintGrid();
			downShift = FALSE;
			ParamControlActive( &printPG, I_RULER, currPrintGrid.angle == 0 );
		}
		return rc;

	case C_REDRAW:
		DrawPrintGrid();
		return C_TERMINATE;

	case C_CANCEL:
		if (printWin == NULL)
			return C_TERMINATE;
		PrintClear();
		DrawPrintGrid();
		wHide( printWin );
		return C_TERMINATE;

	case C_OK:
		DoPrintPrint( NULL );
		return C_TERMINATE;

	case C_CMDMENU:
		wMenuPopupShow( printGridPopupM );
		return C_CONTINUE;

	default:
		return C_CONTINUE;
	}
}
コード例 #23
0
ファイル: Report.cpp プロジェクト: ultimatepp/mirror
Report& Report::Landscape()
{
	Size sz = GetSize();
	SetPageSize(sz.cy, sz.cx);
	return *this;
}
コード例 #24
0
ファイル: Report.cpp プロジェクト: ultimatepp/mirror
Report::Report(int cx, int cy)
{
	mg.x = mg.y = Null;
	SetPageSize(cx, cy);
}
コード例 #25
0
ファイル: codecext.c プロジェクト: BenjaminSchiborr/safe
// Report the page size to the codec, called from pager.c (address passed in sqlite3PagerSetCodec)
void sqlite3CodecSizeChange(void *pCodec, int pageSize, int nReserve)
{
    SetPageSize(pCodec, pageSize);
}
コード例 #26
0
void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(
                       const PAGE_INFO& aPageInfo,
                       const TITLE_BLOCK& aTitleBlock,
                       COLOR4D aColor, COLOR4D aAltColor )
{
    WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance();

    #define milsTomm (25.4/1000)

    m_titleBlock = &aTitleBlock;
    m_paperFormat = &aPageInfo.GetType();

    wxPoint LTmargin( Mm2mils( pglayout.GetLeftMargin() ),
                      Mm2mils( pglayout.GetTopMargin() ) );
    wxPoint RBmargin( Mm2mils( pglayout.GetRightMargin() ),
                      Mm2mils( pglayout.GetBottomMargin() ) );

    SetMargins( LTmargin, RBmargin );
    SetPageSize( aPageInfo.GetSizeMils() );

    // Build the basic layout shape, if the layout list is empty
    if( pglayout.GetCount() == 0 && !pglayout.VoidListAllowed() )
        pglayout.SetPageLayout();

    WORKSHEET_DATAITEM::m_WSunits2Iu = m_milsToIu / milsTomm;
    WORKSHEET_DATAITEM::m_Color = aColor;       // the default color to draw items
    WORKSHEET_DATAITEM::m_AltColor = aAltColor; // an alternate color to draw items

    // Left top corner position
    DPOINT lt_corner;
    lt_corner.x = pglayout.GetLeftMargin();
    lt_corner.y = pglayout.GetTopMargin();
    WORKSHEET_DATAITEM::m_LT_Corner = lt_corner;

    // Right bottom corner position
    DPOINT rb_corner;
    rb_corner.x = (m_pageSize.x*milsTomm) - pglayout.GetRightMargin();
    rb_corner.y = (m_pageSize.y*milsTomm) - pglayout.GetBottomMargin();
    WORKSHEET_DATAITEM::m_RB_Corner = rb_corner;

    WS_DRAW_ITEM_TEXT* gtext;
    int pensize;

    for( unsigned ii = 0; ; ii++ )
    {
        WORKSHEET_DATAITEM*  wsItem = pglayout.GetItem( ii );

        if( wsItem == NULL )
            break;

        // Generate it only if the page option allows this
        if( wsItem->GetPage1Option() < 0    // Not on page 1
            && m_sheetNumber <= 1 )
            continue;

        if( wsItem->GetPage1Option() > 0    // Only on page 1
            && m_sheetNumber > 1 )
            continue;

        COLOR4D color = wsItem->GetItemColor();

        pensize = wsItem->GetPenSizeUi();

        switch( wsItem->GetType() )
        {
        case WORKSHEET_DATAITEM::WS_TEXT:
        {
            WORKSHEET_DATAITEM_TEXT * wsText = (WORKSHEET_DATAITEM_TEXT*)wsItem;
            bool multilines = false;

            if( wsText->m_SpecialMode )
                wsText->m_FullText = wsText->m_TextBase;
            else
            {
                wsText->m_FullText = BuildFullText( wsText->m_TextBase );
                multilines = wsText->ReplaceAntiSlashSequence();
            }

            if( wsText->m_FullText.IsEmpty() )
                break;

            if( pensize == 0 )
                pensize = m_penSize;

            wsText->SetConstrainedTextSize();
            wxSize textsize;

            textsize.x = KiROUND( wsText->m_ConstrainedTextSize.x
                                  * WORKSHEET_DATAITEM::m_WSunits2Iu );
            textsize.y = KiROUND( wsText->m_ConstrainedTextSize.y
                                  * WORKSHEET_DATAITEM::m_WSunits2Iu );

            if( wsText->IsBold())
                pensize = GetPenSizeForBold( std::min( textsize.x, textsize.y ) );

            for( int jj = 0; jj < wsText->m_RepeatCount; jj++)
            {
                if( jj && ! wsText->IsInsidePage( jj ) )
                    continue;

                gtext = new WS_DRAW_ITEM_TEXT( wsText, wsText->m_FullText,
                                               wsText->GetStartPosUi( jj ),
                                               textsize, pensize, color,
                                               wsText->IsItalic(),
                                               wsText->IsBold() );
                Append( gtext );
                gtext->SetMultilineAllowed( multilines );
                wsText->TransfertSetupToGraphicText( gtext );

                // Increment label for the next text
                // (has no meaning for multiline texts)
                if( wsText->m_RepeatCount > 1 && !multilines )
                    wsText->IncrementLabel( (jj+1)*wsText->m_IncrementLabel);
            }
        }
            break;

        case WORKSHEET_DATAITEM::WS_SEGMENT:
            if( pensize == 0 )
                pensize = m_penSize;

            for( int jj = 0; jj < wsItem->m_RepeatCount; jj++ )
            {
                if( jj && ! wsItem->IsInsidePage( jj ) )
                    continue;
                Append( new WS_DRAW_ITEM_LINE( wsItem, wsItem->GetStartPosUi( jj ),
                                               wsItem->GetEndPosUi( jj ),
                                               pensize, color ) );
            }
            break;

        case WORKSHEET_DATAITEM::WS_RECT:
            if( pensize == 0 )
                pensize = m_penSize;

            for( int jj = 0; jj < wsItem->m_RepeatCount; jj++ )
            {
                if( jj && ! wsItem->IsInsidePage( jj ) )
                    break;

                Append( new WS_DRAW_ITEM_RECT( wsItem, wsItem->GetStartPosUi( jj ),
                                               wsItem->GetEndPosUi( jj ),
                                               pensize, color ) );
            }
            break;

        case WORKSHEET_DATAITEM::WS_POLYPOLYGON:
        {
            WORKSHEET_DATAITEM_POLYPOLYGON * wspoly =
                (WORKSHEET_DATAITEM_POLYPOLYGON*) wsItem;
            for( int jj = 0; jj < wsItem->m_RepeatCount; jj++ )
            {
                if( jj && ! wsItem->IsInsidePage( jj ) )
                    continue;

                for( int kk = 0; kk < wspoly->GetPolyCount(); kk++ )
                {
                    const bool fill = true;
                    WS_DRAW_ITEM_POLYGON* poly = new WS_DRAW_ITEM_POLYGON( wspoly,
                                                wspoly->GetStartPosUi( jj ),
                                                fill, pensize, color );
                    Append( poly );

                    // Create polygon outline
                    unsigned ist = wspoly->GetPolyIndexStart( kk );
                    unsigned iend = wspoly->GetPolyIndexEnd( kk );
                    while( ist <= iend )
                        poly->m_Corners.push_back(
                            wspoly->GetCornerPositionUi( ist++, jj ) );

                }
            }
        }
            break;

        case WORKSHEET_DATAITEM::WS_BITMAP:

            ((WORKSHEET_DATAITEM_BITMAP*)wsItem)->SetPixelScaleFactor();

            for( int jj = 0; jj < wsItem->m_RepeatCount; jj++ )
            {
                if( jj && ! wsItem->IsInsidePage( jj ) )
                    continue;

                Append( new WS_DRAW_ITEM_BITMAP( wsItem,
                    wsItem->GetStartPosUi( jj ) ) );
            }
            break;

        }
    }
}
コード例 #27
0
ファイル: cprint.c プロジェクト: sharkcz/xtrkcad
static void PrintSnapShot( void )
/*
 * Called when print:SnapShot button is clicked.
 * Set scale and orientation so the whole layout is printed on one page.
 */
{
	coOrd size;
	ANGLE_T scaleX, scaleY;
	long scaleH, scaleV;
	int i;
	coOrd pageSize;
	POS_T t;

	PrintClear();
	DrawPrintGrid();
	SetPageSize( FALSE );
	pageSize = realPageSize;
	if (pageSize.x > pageSize.y) {
		t = pageSize.x;
		pageSize.x = pageSize.y;
		pageSize.y = t;
	}
	size = mapD.size;

	scaleH = 1;
	for (i=0;i<3;i++) {
		size = mapD.size;
		size.x += 0.75*scaleH;
		size.y += 0.75*scaleH;
		if (printGaudy)
			size.y += 1.0*scaleH;
		scaleX = size.x/pageSize.x;
		scaleY = size.y/pageSize.y;
		scaleH = (long)ceil(max( scaleX, scaleY ));
	}

	scaleV = 1;
	for (i=0;i<3;i++) {
		size = mapD.size;
		size.x += 0.75*scaleV;
		size.y += 0.75*scaleV;
		if (printGaudy)
			size.y += 1.0*scaleV;
		scaleX = size.x/pageSize.y;
		scaleY = size.y/pageSize.x;
		scaleV = (long)ceil(max( scaleX, scaleY ));
	}

	if ( scaleH <= scaleV ) {
		printScale = scaleH;
		printFormat = PORTRAIT;
	} else {
		printScale = scaleV;
		printFormat = LANDSCAPE;
	}

	SetPageSize( TRUE );
/*
	if (printFormat == LANDSCAPE) {
		currPrintGrid.orig.x = -0.5*printScale;
		currPrintGrid.orig.y = maxPageSize.x-0.5*printScale;
		currPrintGrid.angle = 90.0;
	} else {*/
		currPrintGrid.orig.x = -0.5*printScale;
		currPrintGrid.orig.y = -0.5*printScale;
		currPrintGrid.angle = 0.0;
/*    }*/
	currPrintGrid.size = maxPageSize;
	newPrintGrid = currPrintGrid;
	iPrintScale = (long)printScale;
	ParamLoadControls( &printPG );
	ParamGroupRecord( &printPG );
	ChangeDim();
	pageCount = 1;
	BITMAP(bm,0,0) = TRUE;
	DrawPrintGrid();
	ParamLoadMessage( &printPG, I_PAGECNT, _("1 page") );
	ParamDialogOkActive( &printPG, TRUE );
	PrintEnableControls();
	wShow( printWin );
}
コード例 #28
0
void
CompositorParent::TransformShadowTree()
{
  Layer* layer = GetPrimaryScrollableLayer();
  ShadowLayer* shadow = layer->AsShadowLayer();
  ContainerLayer* container = layer->AsContainerLayer();

  const FrameMetrics* metrics = &container->GetFrameMetrics();
  const gfx3DMatrix& rootTransform = mLayerManager->GetRoot()->GetTransform();
  const gfx3DMatrix& currentTransform = layer->GetTransform();

  float rootScaleX = rootTransform.GetXScale();
  float rootScaleY = rootTransform.GetYScale();

  if (mIsFirstPaint && metrics) {
    nsIntPoint scrollOffset = metrics->mViewportScrollOffset;
    mContentSize = metrics->mContentSize;
    SetFirstPaintViewport(scrollOffset.x, scrollOffset.y,
                          1/rootScaleX,
                          mContentSize.width,
                          mContentSize.height,
                          metrics->mCSSContentSize.width,
                          metrics->mCSSContentSize.height);
    mIsFirstPaint = false;
  } else if (metrics && (metrics->mContentSize != mContentSize)) {
    mContentSize = metrics->mContentSize;
    SetPageSize(1/rootScaleX, mContentSize.width,
                mContentSize.height,
                metrics->mCSSContentSize.width,
                metrics->mCSSContentSize.height);
  }

  // We synchronise the viewport information with Java after sending the above
  // notifications, so that Java can take these into account in its response.
  if (metrics) {
    // Calculate the absolute display port to send to Java
    nsIntRect displayPort = metrics->mDisplayPort;
    nsIntPoint scrollOffset = metrics->mViewportScrollOffset;
    displayPort.x += scrollOffset.x;
    displayPort.y += scrollOffset.y;

    SyncViewportInfo(displayPort, 1/rootScaleX, mLayersUpdated,
                     mScrollOffset, mXScale, mYScale);
    mLayersUpdated = false;
  }

  // Handle transformations for asynchronous panning and zooming. We determine the
  // zoom used by Gecko from the transformation set on the root layer, and we
  // determine the scroll offset used by Gecko from the frame metrics of the
  // primary scrollable layer. We compare this to the desired zoom and scroll
  // offset in the view transform we obtained from Java in order to compute the
  // transformation we need to apply.
  if (metrics) {
    float tempScaleDiffX = rootScaleX * mXScale;
    float tempScaleDiffY = rootScaleY * mYScale;

    nsIntPoint metricsScrollOffset(0, 0);
    if (metrics->IsScrollable())
      metricsScrollOffset = metrics->mViewportScrollOffset;

    nsIntPoint scrollCompensation(
      (mScrollOffset.x / tempScaleDiffX - metricsScrollOffset.x) * mXScale,
      (mScrollOffset.y / tempScaleDiffY - metricsScrollOffset.y) * mYScale);
    ViewTransform treeTransform(-scrollCompensation, mXScale, mYScale);
    shadow->SetShadowTransform(gfx3DMatrix(treeTransform) * currentTransform);
  } else {
    ViewTransform treeTransform(nsIntPoint(0,0), mXScale, mYScale);
    shadow->SetShadowTransform(gfx3DMatrix(treeTransform) * currentTransform);
  }
}
コード例 #29
0
ファイル: trans3.c プロジェクト: chunhualiu/OpenNT
DoFileOpen( LPSTR lpstrFileName ) // filename may be NULL )
{
    /* return whether error.  Use CommDlg for open dialog (3.8.91) D. Kent */
    /* ********* International version changes bz 2/21/86 *************
    For files opened in Word format and converted to Write format
    the following changes are made:
       the vWordFmtMode flag is left set to CONVFROMWORD. The file is
       saved, effecting the change to Word format, but the original
       Word file in not renamed, so it is left untouched, with no need to
       make a backup. On the next save, we ask if the file with that name
       (the Word document) should be replaced, so any file with that
       name that existed will be protected.
    *************************************************************** */

    extern int vfDiskError;
    int fn=fnNil;
    int doc;
    CHAR (**hsz)[] = NULL;
    int nRetval=FALSE;
    CHAR rgch[cchMaxFile];
    extern DoOpenFilenameGet(LPSTR);
    BOOL bOpened=TRUE,      // ObjOpenedDoc has succeeded
         bCancelled=FALSE;

#ifdef INTL /* International version */
int fWordDoc;
#endif  /* International version */

    EnableOtherModeless(FALSE);

    /* prevent WM_PAINT from painting a doc that isn't defined */

    while(1)
    {
        bCancelled = FALSE;

        if (lpstrFileName)
            lstrcpy(rgch,lpstrFileName);
        else if (!DoOpenFilenameGet(rgch))
        {
            bCancelled = TRUE;
            goto KeepTrying;
        }
        else if (rgch[0] == '\0')
        {
            bCancelled = TRUE;
            goto KeepTrying;
        }

#if defined(OLE)
        if (bOpened) 
            if (ObjClosingDoc(docCur,rgch))
            /*  
                If this failed, then we could't close this document, much less
                open a new one.
            */
                break; // from while
            else
            /**
                At this point, docCur is OLE-closed!!!  Gotta be sure we
                open a new one!!! 
            **/
                bOpened = FALSE;
#endif


        if ((fn = FnOpenSz( rgch, dtyNormNoExt, FALSE)) == fnNil)
        /* this has side effect of setting &(**(**hpfnfcb) [fn].hszFile) [0] 
        to "normalized" filename. */
        {
            /* Open failed */
            goto KeepTrying;
        }
        else
        {   /* Opened file OK */
            /* Set caption to "Loading file..." */

            extern CHAR szLoadFile[];
            extern CHAR szCvtLoadFile[];

#ifdef INTL /* International version */
            /* **************************************
            * added check for international version to
                    do Word format conversion. If Word format,
                    bring up another dialog box.
            * ************************************** */

            /* TestWordCvt return values:

            -1 means dialog box failed (error already sent)
            -2 means cancel without conversion.
            FALSE means not a word document.
            TRUE means convert this word document.
            *** as of 2/14/86, we changed the conversion
            to not make a backup, but to save the file
            in write format without renaming the Word
            file, so the word file is effectively
            backed up under its original name. See
            CleanDoc in trans2.c for explanations.
            */

            switch ((fWordDoc = TestWordCvt (fn, hParentWw)))
            {
                case -2: // CANCEL
                    bCancelled = TRUE;
                    // fall through..

                case -1: // ERROR
                    /* Release this fn! */
                    FreeFn(fn);
                    CloseEveryRfn( TRUE );
                    goto KeepTrying;
            }

            /* if true, will convert soon */
            if (fWordDoc)
                {
                SetWindowText(hParentWw, (LPSTR)szCvtLoadFile);
                }
            else
#endif  /* International version */
                SetWindowText(hParentWw, (LPSTR)szLoadFile);

            StartLongOp();

            ReadFilePages( fn );
        }

        Assert( fn != fnNil );
        bltsz( &(**(**hpfnfcb) [fn].hszFile) [0], rgch );

        CchCopySz(rgch, szUser);

        hsz=NULL;

        if ( !FNoHeap(hsz = HszCreate( (PCH) rgch )) )
        {
            if ((doc = DocCreate( fn, hsz, dtyNormal )) != docNil)
            {   /* Succeeded in creating document */

                KillDoc( docCur );
                docCur = doc;
                hsz = NULL; // don't free cause used by doc

#ifdef INTL /* International version */
            /* if a word document to be converted, save it doing conversion. */
                if (fWordDoc)
                {
                    /* save file in write format. */
                    ConvertFromWord();
                    vfTextOnlySave = FALSE;
                    (**hpdocdod)[docCur].fDirty = TRUE;
                }
#endif  /* International version */

                ChangeWwDoc( szUser );
                /* Ensure that the margins of this document is right
                for the printer. */
                vfWarnMargins = TRUE;
                SetPageSize();
                vfWarnMargins = FALSE;
#if defined(OLE)
                if (ObjOpenedDoc(docCur)) 
                /* Couldn't open.  Must try to open a new one */
                    goto KeepTrying;
                else
                {
                    bOpened = TRUE;
                    break; // from while loop 'cause we're done
                }
#endif
            }
        }

        KeepTrying:
        /* get to here either because error or cancelled */

        vfDiskError = ferror = FALSE;
        SetTitle( **(**hpdocdod)[ docCur ].hszFile );

        if (hsz)
        {
            FreeH( hsz );
            hsz=NULL;
        }

        CloseEveryRfn( TRUE );

        EndLongOp(vhcArrow);

        if (bCancelled)
        /* can't cancel unless we have an opened document */
        {
            if (!bOpened) // currently no open doc
            {
                if (bOpened = !ObjOpenedDoc(docCur)) // returns FALSE if success
                    break;
            }
            else
                break;
        }

    }  // end of while(1)


#if WINVER >= 0x300
    FreeUnreferencedFns();
#endif

    EndLongOp(vhcArrow);
    EnableOtherModeless(TRUE);
    return !bOpened;

} /* end of DoFileOpen */
コード例 #30
0
ファイル: project.c プロジェクト: Benwang217/SF100Linux
void SetProgReadCommand(void)
{
    static const unsigned int AT26DF041 = 0x1F4400;
    static const unsigned int AT26DF004 = 0x1F0400;
    static const unsigned int AT26DF081A = 0x1F4501;
    mcode_WREN = WREN;
    mcode_RDSR = RDSR;
    mcode_WRSR = WRSR;
    mcode_ChipErase = CHIP_ERASE;
    mcode_Program = PAGE_PROGRAM;
    mcode_Read    = BULK_FAST_READ;
    mcode_SegmentErase= SE;
    mcode_WRDI=0x04;
    mcode_ProgramCode_4Adr=0xFF;
    mcode_ReadCode=0xFF;

    if(strcmp(Chip_Info.Class,SUPPORT_SST_25xFxx)==0)
    {
        mcode_RDSR = RDSR;
        mcode_WRSR = WRSR;
        mcode_ChipErase = 0x60;
        mcode_Read  = BULK_NORM_READ;

        if(strstr(Chip_Info.TypeName,"B") != NULL ||strstr(Chip_Info.TypeName,"W") != NULL)
            mcode_Program = AAI_2_BYTE ;
        else
            mcode_Program = AAI_1_BYTE ;
    }
    else if(strstr(Chip_Info.Class,SUPPORT_SST_25xFxxA)!=NULL)
    {
        mcode_RDSR = RDSR;
        mcode_WRSR = WRSR;
        mcode_ChipErase = 0x60;
        mcode_Read = BULK_NORM_READ;
        mcode_Program = AAI_1_BYTE ;
    }
    else if(strstr(Chip_Info.Class,SUPPORT_SST_25xFxxB)!=NULL)
    {
        mcode_RDSR = RDSR;
        mcode_WRSR = WRSR;
        mcode_ChipErase = 0x60;
        mcode_Read      = BULK_NORM_READ;
        mcode_Program   = AAI_2_BYTE ;
        mcode_SegmentErase  = 0xD8;
        mcode_WRDI = WRDI;
    }
    else if(strstr(Chip_Info.Class,SUPPORT_SST_25xFxxC) != NULL)
    {
        mcode_RDSR = RDSR;
        mcode_WRSR = WRSR;
        mcode_ChipErase = 0x60;
        mcode_Read      = BULK_FAST_READ;
        mcode_Program   = PAGE_PROGRAM ;
        mcode_SegmentErase  = 0xD8;
        mcode_WREN = WREN;
    }
    else if(strstr(Chip_Info.Class,SUPPORT_ATMEL_AT25FSxxx) != NULL)
    {
        mcode_RDSR = RDSR;
        mcode_WRSR = WRSR;
        mcode_ChipErase = CHIP_ERASE;
        mcode_Read      = BULK_NORM_READ;
        mcode_Program   = PP_128BYTE ;
        mcode_SegmentErase  = 0xD8;
    }
    else if(strstr(Chip_Info.Class,SUPPORT_ATMEL_AT25Fxxx) != NULL)
    {
        mcode_RDSR = RDSR;
        mcode_WRSR = WRSR;
        mcode_ChipErase = CHIP_ERASE;
        mcode_Read      = BULK_NORM_READ;
        mcode_Program   = PP_128BYTE ;
        mcode_SegmentErase  = 0x52;
    }
    else if(strstr(Chip_Info.Class,SUPPORT_ATMEL_AT26xxx) != NULL)
    {
        mcode_RDSR = RDSR;
        mcode_WRSR = WRSR;
        mcode_ChipErase = CHIP_ERASE;
        mcode_Read      = BULK_FAST_READ;
        mcode_SegmentErase  = 0xD8;
        if(AT26DF041 == Chip_Info.UniqueID)
        {
            mcode_Program = PP_AT26DF041;
        }
        else if(AT26DF004 == Chip_Info.UniqueID)
        {
            mcode_Program = AAI_1_BYTE;
        }
        else
        {
            mcode_Program = PAGE_PROGRAM;
        }
    }
    else if(strstr(Chip_Info.Class,SUPPORT_ESMT_F25Lxx) != NULL)
    {
        const unsigned int F25L04UA=0x8C8C8C;
        mcode_RDSR = RDSR;
        mcode_WRSR = WRSR;
        mcode_ChipErase = CHIP_ERASE;
        mcode_Read      = BULK_FAST_READ;
        mcode_SegmentErase  = 0xD8;
        if(F25L04UA == Chip_Info.UniqueID)
            mcode_Program = AAI_1_BYTE;
        else
            mcode_Program = AAI_2_BYTE;//PAGE_PROGRAM;
    }
    else if(strstr(Chip_Info.Class,SUPPORT_NUMONYX_Alverstone) != NULL)
    {
        mcode_RDSR = RDSR;
        mcode_WRSR = WRSR;
        mcode_ChipErase = CHIP_ERASE;
        mcode_Read      = BULK_NORM_READ;
        mcode_Program   = MODE_NUMONYX_PCM ;
        mcode_SegmentErase  = 0xD8;
    }
    else if(strstr(Chip_Info.Class,SUPPORT_EON_EN25QHxx_Large) != NULL
            || strstr(Chip_Info.Class,SUPPORT_MACRONIX_MX25Lxxx_Large) != NULL)
    {
        mcode_RDSR = RDSR;
        mcode_WRSR = WRSR;
        mcode_ChipErase = CHIP_ERASE;
        mcode_Read      = BULK_4BYTE_FAST_READ;
        mcode_Program   = PP_4ADR_256BYTE ;
        mcode_SegmentErase  = 0xD8;
        mcode_ProgramCode_4Adr = 0x02;
        mcode_ReadCode = 0x0B;
    }
    else if(strstr(Chip_Info.Class,SUPPORT_SPANSION_S25FLxx_Large) != NULL)
    {
        mcode_RDSR = RDSR;
        mcode_WRSR = WRSR;
        mcode_ChipErase = CHIP_ERASE;
        mcode_Read      = BULK_4BYTE_FAST_READ;
        mcode_Program   = PP_4ADR_256BYTE ;
        mcode_SegmentErase  = 0xD8;
        mcode_ProgramCode_4Adr = 0x12;
        mcode_ReadCode = 0x0C;
        //printf("Read Code=%X\r\n",mcode_ReadCode);
    }
    else if(strstr(Chip_Info.Class,SUPPORT_NUMONYX_N25Qxxx_Large) != NULL)
    {
        mcode_RDSR = RDSR;
        mcode_WRSR = WRSR;
        mcode_ChipErase = CHIP_ERASE;
        mcode_Read      = BULK_4BYTE_FAST_READ_MICRON;
        mcode_Program   = PP_4ADDR_256BYTE_MICROM ;
        if(strstr(Chip_Info.TypeName,"N25Q512") != NULL)
            mcode_SegmentErase  = 0xD4;
        else
            mcode_SegmentErase  = 0xD8;
        mcode_ProgramCode_4Adr = 0x02;
        mcode_ReadCode = 0x0B;
    }
    else if(strstr(Chip_Info.Class,SUPPORT_MACRONIX_MX25Lxxx_PP32) != NULL)
    {
        mcode_RDSR = RDSR;
        mcode_WRSR = WRSR;
        mcode_ChipErase = CHIP_ERASE;
        mcode_Read      = BULK_FAST_READ;
        mcode_Program   = PP_32BYTE ;
        mcode_SegmentErase  = 0xD8;
    }
    else if(strstr(Chip_Info.Class,SUPPORT_WINBOND_W25Pxx_Large) != NULL)
    {
        mcode_RDSR = RDSR;
        mcode_WRSR = WRSR;
        mcode_ChipErase = CHIP_ERASE;
        mcode_Program = PP_4ADR_256BYTE;
        mcode_Read    = BULK_4BYTE_FAST_READ;
        mcode_SegmentErase= SE;
        mcode_ProgramCode_4Adr = 0x02;
        mcode_ReadCode = 0x0C;
    }
    else if(strstr(Chip_Info.Class,SUPPORT_ATMEL_45DBxxxB) != NULL)
    {
        mcode_RDSR = 0xD7;
        mcode_WRSR = 0;
        mcode_Read      = BULK_AT45xx_READ;
        mcode_Program   = PAGE_WRITE;
        mcode_SegmentErase  = 0;
        CHIP_INFO mem_id;
        SetPageSize(&mem_id, 0);
        Chip_Info.ChipSizeInByte=GetChipSize();
        Chip_Info.PageSizeInByte=GetPageSize();
    }
    else if(strstr(Chip_Info.Class,SUPPORT_ATMEL_45DBxxxD) != NULL)
    {
        mcode_RDSR = 0xD7;
        mcode_WRSR = 0;
        mcode_Read      = BULK_AT45xx_READ;
        mcode_Program   = PAGE_WRITE;
        mcode_SegmentErase  = 0;
        CHIP_INFO mem_id;
        SetPageSize(&mem_id, 0);
        Chip_Info.ChipSizeInByte=GetChipSize();
        Chip_Info.PageSizeInByte=GetPageSize();
    }
//	printf("Erase Code=%X\r\n",mcode_ChipErase);
//    printf("Read Code=%X\r\n",mcode_ReadCode);
//    printf("mcode_ProgramCode_4Adr=%X\r\n",mcode_ProgramCode_4Adr);
}