ObjectARX, AutoCAD. Среда программирования библиотеки C++


AcApProfileManagerReactor Класс - часть 2


currentProfileReset(const char *curProfile)

{

acutPrintf("\nCurrent profile has been reset: %s", curProfile);

}

 

void

AsdkProfileManagerReactor::

profileWillReset(const char *profName)

{

acutPrintf("\nNon-current profile will be reset: %s", profName);

}

 

void

AsdkProfileManagerReactor::

profileReset(const char *profName)

{

acutPrintf("\nNon-current profile has been reset:%s", profName);

}

 

void

aFunction()

{

acutPrintf("This is AsdkProfileSample Test Application...\n");

// Attach the reactor for the duration of this command. Normally

// this would be added upon application initialization.

//

AsdkProfileManagerReactor *pProfileRector =

new AsdkProfileManagerReactor();

acProfileManagerPtr()->addReactor(pProfileRector);

// Obtain the path for the registry keys and print it out.

//

char *pstrKey;

acProfileManagerPtr()->ProfileRegistryKey(pstrKey, NULL);

if (pstrKey != NULL) {

acutPrintf("\nThe profiles registry key is: %s", pstrKey);

acutDelString(pstrKey);

}

// Get the list of all profiles in the user’s configuration

// and print them out.

//

AcApProfileNameArray arrNameList;

int nProfiles =

acProfileManagerPtr()->ProfileListNames(arrNameList);

acutPrintf("\nNumber of profiles currently "

"in the user profile list is: %d", nProfiles);

for (int i = 0; i < nProfiles; i++)

acutPrintf("\nProfile name is: %s", arrNameList[i]);

// Copy the unnamed profile to the AsdkTestProfile.

//

acProfileManagerPtr()->ProfileCopy(

"AsdkTestProfile",

"<<Unnamed Profile>>",

"This is a test");

// Reset the newly copied profile to AutoCAD defaults.

//

acProfileManagerPtr()->ProfileReset("AsdkTestProfile");

// Make this new profile current.

//

acProfileManagerPtr()->ProfileSetCurrent("AsdkTestProfile");

// Change a value in the profile. For this example, make the

// cursor big.

//

struct resbuf rbCursorSize;

rbCursorSize.restype = RTSHORT;

rbCursorSize.resval.rint = 100;

acedSetVar("CURSORSIZE", &rbCursorSize);

// Rename the profile to a new name.

//

acProfileManagerPtr()->ProfileRename(

"AsdkTestProfile2",

"AsdkTestProfile",

"This is another test");

// Export the profile.

//

acProfileManagerPtr()->ProfileExport(

"AsdkTestProfile2",

"./AsdkTestProfile2.arg");

// Import the profile.

//

acProfileManagerPtr()->ProfileImport(

"AsdkTestProfile3",

"./AsdkTestProfile2.arg",

"This is a copy of AsdkTestProfile2"

"by Exporting/Importing",

Adesk::kTrue);

// Remove the reactor.

//

acProfileManagerPtr()->removeReactor(pProfileRector);

}




- Начало -  - Назад -  - Вперед -