📄 project.h
字号:
/*------------------------------------------------------------------------------*
* File Name: Project.h *
* Creation: CPY 2/1/2002 *
* Purpose: Origin C Project Class Header *
* Copyright (c) OriginLab Corp.2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 *
* All Rights Reserved *
* *
* Modification Log: *
*------------------------------------------------------------------------------*/
#ifndef _PROJECT_H
#define _PROJECT_H
#include <data.h>
#include <Graph.h>
#include <Page.h>
#include <Folder.h>
#if _OC_VER > 0x0703
#include <Settings.h>
// #include <OperationManager.h>
// #include <Operation.h>
#endif
/** >Internal Origin Objects
The Project class provides methods and properties to access many of the objects
contained in an Origin project file. The Project class includes collections
of all different page types and collections of loose data sets (data sets not
in a worksheet column) and of all data sets in the Origin Project file. Several
methods to get objects active in the Origin project file (such as ActiveCurve,
ActiveLayer, and ActiveFolder) and a RootFolder property are also available.
An Origin C Project object is a wrapper object that is a reference to an internal
Origin project object. Origin C wrapper objects do not actually exist in Origin and
merely refer to the internal Origin object. Only one project file at a time can be
open in Origin consequently all Origin C Project objects refer to the same currently
open project file.
Example:
// try to count the total number layers in all graphs in project
int nCount = 0;
foreach(GraphPage gp in Project.GraphPages)
{
foreach(GraphLayer gl in gp.Layers)
{
nCount++;
}
}
out_int("total number of layers=",nCount);
out_str("");// another blank line
*/
class Project
{
public:
/**
Default constructor. Note that in Origin there can only be one Project open
at a time, so it is not necessary to attach a Project object (see the example).
The Origin C Project object is attached and valid by default.
Parameters:
None.
Example:
// For this example to run, create several windows in Origin
// (graphs, worksheets, etc).
void run_Project()
{
PageBase pg;
// Create a Project object
Project proj;
// Loop over all the pages in the project and display their names:
foreach (pg in proj.Pages)
{
out_str(pg.GetName());
}
}
// Since a Project object does not need to be initialized, the same function
// can be written like this, where "Project" is used as a global object:
void run_Project()
{
PageBase pg;
// Loop over all the pages in the project and display their names:
foreach (pg in Project.Pages)
{
out_str(pg.GetName());
}
}
*/
Project();
/**
Collection of all the pages in the project.
Example:
// For this example to run, create several windows in Origin
// (graphs, worksheets, etc).
void run_Project_Pages()
{
PageBase pg;
// Loop over all the pages in the project and display their names:
foreach (pg in Project.Pages)
{
out_str(pg.GetName());
}
}
*/
Collection<PageBase> Pages;
/**
Collection of all the worksheet pages in the project.
Example:
// For this example to run, create several worksheets in Origin.
void run_Project_WorksheetPages()
{
WorksheetPage pg;
// Loop over all the worksheet pages in the project and display their names:
foreach (pg in Project.WorksheetPages)
{
out_str(pg.GetName());
}
}
*/
Collection<WorksheetPage> WorksheetPages;
/**
Collection of all the Note pages in the project.
Example:
// For this example to run, create several Notes windows in Origin.
void run_Project_Notes()
{
Note pg;
// Loop over all the Note pages in the project and display their names:
foreach (pg in Project.Notes)
{
out_str(pg.GetName());
}
}
*/
Collection<Note> Notes;
/**
Collection of all the matrix pages in the project.
Example:
// For this example to run, create several matrices in Origin.
void run_Project_MatrixPages()
{
MatrixPage pg;
// Loop over all the matrix pages in the project and display their names:
foreach (pg in Project.MatrixPages)
{
out_str(pg.GetName());
}
}
*/
Collection<MatrixPage> MatrixPages;
/**
Collection of all the graph pages in the project.
Example:
// For this example to run, create several graphs in Origin.
void run_Project_GraphPages()
{
GraphPage pg;
// Loop over all the graph pages in the project and display their names:
foreach (pg in Project.GraphPages)
{
out_str(pg.GetName());
}
}
*/
Collection<GraphPage> GraphPages;
/**
Collection of all the layout pages in the project.
Example:
// For this example to run, create several layout pages in Origin.
void run_Project_LayoutPages()
{
LayoutPage pg;
// Loop over all the layout pages in the project and display their names:
foreach (pg in Project.LayoutPages)
{
out_str(pg.GetName());
}
}
*/
Collection<LayoutPage> LayoutPages;
/**
Collection of Names of all the Datasets not attached to a worksheet or a matrix in the current project.
Example:
void run_Project_DatasetNames()
{
int ii = 1;
foreach(string strName in Project.LooseDatasetNames)
{
printf("Dataset(%d) Name: %s\n",ii++, strName);
}
}
*/
Collection<string> LooseDatasetNames;
/**
Collection of Names of all the Datasets in the current project.
Example:
void run_Project_DatasetNames()
{
int ii = 1;
foreach(string strName in Project.DatasetNames)
{
printf("Dataset(%d) Name: %s\n",ii++, strName);
}
}
*/
Collection<string> DatasetNames;
/**
Gets a PageBase object by index.
Parameters:
index = (optional) the 0-offset index of the PageBase object in project, or
-1 for the active page.
Returns:
the index'th PageBase or the active PageBase.
Example:
// For this example to run, create at least one window (graph, worksheet, etc.).
void run_Project_Pages()
{
// Get the first page:
PageBase pg = Project.Pages(0);
// Display the page name:
out_str(pg.GetName());
}
*/
PageBase Pages(int index = -1);
/**
Gets a WorksheetPage object by index.
Parameters:
index = the 0-offset index of the WorksheetPage object in project.
Returns:
the index'th WorksheetPage in project.
Example:
// For this example to run, create at least one worksheet.
void run_Project_WorksheetPages()
{
// Get the first WorksheetPage:
WorksheetPage pg = Project.WorksheetPages(0);
// Display the page name:
out_str(pg.GetName());
}
*/
WorksheetPage WorksheetPages(int index);
/**
Gets a Notes window by index.
Parameters:
index = the 0-offset index of the Note object in project.
Returns:
the index'th Note object in project.
Example:
// For this example to run, create at least one Notes window.
void run_Project_Notes()
{
// Get the first Note in project:
Note pg = Project.Notes(0);
// Display the page name:
out_str(pg.GetName());
}
*/
Note Notes(int index);
/**
Gets a Matrix window by index.
Parameters:
index = the 0-offset index of the MatrixPage object in project.
Returns:
the index'th MatrixPage in project.
Example:
// For this example to run, create at least one matrix window.
void run_Project_MatrixPages()
{
// Get the first MatrixPage in project:
MatrixPage pg = Project.MatrixPages(0);
// Display the page name:
out_str(pg.GetName());
}
*/
MatrixPage MatrixPages(int index);
/**
Gets a graph window by index.
Parameters:
index = the 0-offset index of the GraphPage object in project.
Returns:
the index'th GraphPage in project.
Example:
// For this example to run, create at least one graph window.
void run_Project_GraphPages()
{
// Get the first GraphPage in project:
GraphPage pg = Project.GraphPages(0);
// Display the page name:
out_str(pg.GetName());
}
*/
GraphPage GraphPages(int index);
/**
Gets a layout window by index.
Parameters:
index = the 0-offset index of the LayoutPage object in project.
Returns:
the index'th LayoutPage in project.
Example:
// For this example to run, create at least one layout window.
void run_Project_LayoutPages()
{
// Get the first LayoutPage in project:
LayoutPage pg = Project.LayoutPages(0);
// Display the page name:
out_str(pg.GetName());
}
*/
LayoutPage LayoutPages(int index);
/**
Gets the name of Dataset which is index'th element in the list.
Parameters:
index = A number smaller than the number of datasets in the project. The datasets are enumerated
by the order in which they appear in the link list and have no special significance.
Returns:
return the name of the dataset.
Remark:
If index is larger than the number of datasets in the project, DatasetNames(int) generates to an execution error.
Example:
void run_Project_DatasetNames(int index)
{
string strName = Project.DatasetNames(index);
printf("Dataset(%d) Name: %s\n",index, strName);
}
*/
string DatasetNames(int index);
/**
Gets the name of Dataset not attached to a worksheet or a matrix, which is index'th element in the list.
Parameters:
index = A number smaller than the number of datasets not attached to a worksheet or a matrix in the project.
The datasets are enumerated by the order in which they appear in the link list and have no special
significance.
Returns:
return the name of the dataset.
Remark:
If index is larger than the number of datasets in the project, DatasetNames(int) generates to an execution error.
Example:
void run_Project_LooseDatasetNames(int index)
{
string strName = Project.LooseDatasetNames(index);
printf("Dataset(%d) Name: %s\n",index, strName);
}
*/
string LooseDatasetNames(int index);
/**
Gets a PageBase object by name.
Parameters:
name = pointer to the name of the page.
Returns:
the PageBase object with the name name.
Example:
// For this example to run, create a worksheet with the name "Data1".
void run_Project_Pages()
{
// Get the page by name:
PageBase pg = Project.Pages("Data1");
// Display the page name:
out_str(pg.GetName());
}
*/
PageBase Pages(LPCSTR name);
/**
Gets a WorksheetPage object by name.
Parameters:
name = pointer to the name of the page.
Returns:
the WorksheetPage object with the name name.
Example:
// For this example to run, create a worksheet with the name "Data1".
void run_Project_WorksheetPages()
{
// Get the page by name:
WorksheetPage pg = Project.WorksheetPages("Data1");
// Display the page name:
out_str(pg.GetName());
}
*/
WorksheetPage WorksheetPages(LPCSTR name);
/**
Gets a Note object by name.
Parameters:
name = pointer to the name of the page.
Returns:
the Note object with the name name.
Example:
// For this example to run, create a Note window with the name "Notes".
void run_Project_Notes()
{
// Get the page by name:
Note pg = Project.Notes("Notes");
// Display the page name:
out_str(pg.GetName());
}
*/
Note Notes(LPCSTR name);
/**
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -