예제 #1
0
void PostScriptView::Comments (ostream& out) {
    PSVersion(out);
    Creator(out);
    FontNames(out);
    Pages(out);
    BoundingBox(out);

    out << "%%EndComments\n\n";
}
예제 #2
0
uint32 TCadPageSet::Build(const TCadGroup* grp, TSize size, float Scale)
{
  Clear();

  TCadPage cadpage;
  TCadRenderInfo render(TPoint(0,0), Scale, TRect(TPoint(0,0), size), NULL);

  // Get extent of group at given scale
  TRect extent(grp->GetExtent(render));
  TRect page(extent.TopLeft(), size);

  cadpage.num=1;
  cadpage.row=1;
  cadpage.col=1;

  // Scan from top of drawing to bottom for rows
  while( ! (extent & page).IsEmpty() ) {

    // Scan from left of drawing to right for columns
    while( ! (extent & page).IsEmpty() ) {
    
      // Add this page if not empty
      render.Page=page;
      //render.Page=page;
      if (grp->ObjectsInPage(render) > 0) {
        cadpage.rect=page;
        Add(cadpage);
        cadpage.num++;
      }

      // Move page one column to the right
      page.MoveTo(page.left+size.cx, page.top);
      cadpage.col++;
    }  // while

    // Move page to next row, left side
    page.MoveTo(extent.left, page.top+size.cy);
    cadpage.row++;
    cadpage.col=1;
  }  // while

  return Pages();
}
예제 #3
0
Bibliographic FieldBuilder::buildField(const KeyValuePair& kvp)
{
	String key = kvp.getKey();
	Bibliographic field = Bibliographic(kvp);

	if (key == "author") {
		field = (Author)field;
		return field; 
	}

	else if (key == "doi") {
		field = Doi();
	}

	else if (key == "issn") {
		field = Issn();
	}

	else if (key == "journal") {
		field = Journal();
	}

	else if (key == "month") {
		field = Month();
	}

	else if (key == "number") {
		field = Number();
	}

	else if (key == "pages") {
		field = Pages();
	}

	else if (key == "title") {
		field = Title();
	}

	else if (key == "url") {
		field = Url();
	}

	else if (key == "urldate") {
		field = UrlDate();
	}

	else if (key == "volume") {
		field = Volume();
	}

	else if (key == "year") {
		field = Year();
	}

	else {
		field = Bibliographic();
		field.setKey(kvp.getKey());
	}
	field.setValue(kvp.getValue());
	return field;
}
예제 #4
0
void FormNoteBook :: PageSelected(wNBPageMsg m)
{
	wNoteBookPage *pw;
	static bool fReSelect = FALSE;
	static bool fFirstCall = TRUE;

	if (fFirstCall)
	{
		// This event always occurs when the first page is added to
		// a notebook.  Since we want the second page to be at the
		// top, we'll skip this event and set the top page after all
		// pages have been constructed.

		fFirstCall = FALSE;
		return;
	}

	if (fReSelect)
	{
		fReSelect = FALSE;
		return;
	}

	pw = m.CurrentTopPage();
	wFormWindow *pgWin;

	// If there is a current top page, dismiss it's form (dialog)
	//
	if (pw)
	{
		if (pw == m.NewTopPage())
			return;

		if ((pgWin = (wFormWindow *)pw->GetWindow()) != NULL)
		{
			if (!pgWin->Exit(AcFormExit, NULL))
			{
				fReSelect = TRUE;	// validation error occured
				GotoPage(pw);		// re-select current top page
				return;
			}
			pgWin->Dismiss();
			pw->SetWindow(NULL);
		}
	}

	// For a new page, find the form associated with the new page
	// and create its window.
	//
	if ((pw = m.NewTopPage()) != NULL)
	{
		if (pw->GetPageHandle() >= IdMajorSections)
		{
			// major tab was selected in section with minor tab pages
			wNoteBookPageList *pl = Pages();
			pl->Find(pw);
			if (pl->Next())		// select the page after the major tab page
				GotoPage(pl->Current());

			return;
		}
		wFormWindow **forms = ((AppWindow *)ParentWindow())->GetDataForms();
		wFormWindow *fp = forms[pw->GetPageHandle()];

		fp->FormUp(this);
		fp->ChangePosition(wPointl(0, 0));
		pw->SetWindow(fp);
		fp->Show();
		(ThisThread->HelpInstance())->SetActiveWindow(fp);
	}
}
예제 #5
0
void WServer::Initialize()
{
	//Start time
	PTBeforeLoad = boost::posix_time::microsec_clock::local_time();

	/* *************************************************************************
	 * ***********************  Connect to SQL Server  *************************
	 * *************************************************************************/
	try
	{
		log("info") << "Connecting to database backend";

		Wt::Dbo::SqlConnection *SQLConnection = new Wt::Dbo::backend::MySQL("wt", "root", "", "127.0.0.1");
		//Wt::Dbo::SqlConnection *SQLConnection = new Wt::Dbo::backend::Sqlite3(":memory:");
		SQLConnection->setProperty("show-queries", "true");
		SQLPool = new Wt::Dbo::FixedSqlConnectionPool(SQLConnection, 1);

		log("success") << "Successfully connected to database";
	}
	catch(Wt::Dbo::Exception &e)
	{
		log("fatal") << "Database error connecting to database: " <<  e.what();
		throw e;
	}
	catch(std::exception &e)
	{
		log("fatal") << "Error connecting to database: " << e.what();
		throw e;
	}

	/* *************************************************************************
	 * ***********************  Initialize Databases  **************************
	 * *************************************************************************/
	try
	{
		_DboManager = new DboDatabaseManager(this, SQLPool);
		_Modules = new ModulesDatabase(_DboManager);
		_Configurations = new ConfigurationsDatabase(_DboManager);
		_Languages = new LanguagesDatabase(_DboManager);
		_Styles = new StylesDatabase(_DboManager);
		_Pages = new PagesDatabase(_DboManager);
		_AccessPaths = new AccessPathsDatabase(_DboManager);
		_NavigationMenus = new NavigationMenusDatabase(_DboManager);
	}
	catch(std::exception &e)
	{
		log("fatal") << "Error initializing databases: " << e.what();
		throw e;
	}

	/* *************************************************************************
	 * ***************************  Create Tables  *****************************
	 * *************************************************************************/
#define REINSTALLDBO 0
#if REINSTALLDBO == 1
	//Drop
	try
	{
		_Installer = new DboInstaller(*SQLPool);
		_Installer->DropTables();
	}
	catch(Wt::Dbo::Exception &e)
	{
		log("error") << "Database error dropping tables: " <<  e.what();
	}
	catch(std::exception &e)
	{
		log("error") << "Error dropping tables: " << e.what();
	}

	//Create
	try
	{
		_Installer->CreateTables();
	}
	catch(Wt::Dbo::Exception &e)
	{
		log("fatal") << "Database error creating tables: " <<  e.what();
		throw e;
	}
	catch(std::exception &e)
	{
		log("fatal") << "Error creating tables: " << e.what();
		throw e;
	}

	//Insert
	try
	{
		_Installer->InsertRows();
	}
	catch(Wt::Dbo::Exception &e)
	{
		log("fatal") << "Database error inserting default data: " <<  e.what();
		throw e;
	}
	catch(std::exception &e)
	{
		log("fatal") << "Error inserting default data: " << e.what();
		throw e;
	}
#endif

	/* *************************************************************************
	 * *************************  Load DboDatabases  ***************************
	 * *************************************************************************/
// 	try
// 	{
		log("info") << "Loading DboDatabaseManager";
		_DboManager->Load();
// 	}
// 	catch(Wt::Dbo::Exception &e)
// 	{
// 		log("fatal") << "Database error loading DboDatabaseManager: " << e.what();
// 		throw e;
// 	}
// 	catch(std::exception &e)
// 	{
// 		log("fatal") << "Error loading DboDatabaseManager: " << e.what();
// 		throw e;
// 	}

	//Server localized strings
	setLocalizedStrings(new DboLocalizedStrings(this));

	Pages()->Register404PageHandler(new Default404Page());
	Pages()->RegisterPageHandler("home", ModulesDatabase::Navigation, new TestPage());
	Pages()->RegisterPageHandler("sitemap", ModulesDatabase::Navigation, new AnotherPage());

	/* *************************************************************************
	 * *********************  Create temporary XML file  ***********************
	 * *************************************************************************/
	try
	{
		log("info") << "Writing XML Configuration file";
		CreateWtXmlConfiguration();
		log("success") << "XML Configuration file created";
	}
	catch(std::exception &e)
	{
		log("fatal") << "Error creating XML Configuration file: " << e.what();
		throw e;
	}

	//Configure authorization module
	ConfigureAuth();
}