Exemplo n.º 1
0
            void ide_device::sync_file_device() {
                try {
                    rhost::util::errors_to_exceptions([&] {
                        int file_device_num = Rf_ndevNumber(_file_device);
                        int ide_device_num = Rf_ndevNumber(device_desc);

                        Rf_selectDevice(file_device_num);
                        GEcopyDisplayList(ide_device_num);
                        Rf_selectDevice(ide_device_num);
                    });
                } catch (rhost::util::r_error&) {
                    auto path = save_empty();
                    send(path);
                }
            }
Exemplo n.º 2
0
RestorePreviousGraphicsDeviceScope::~RestorePreviousGraphicsDeviceScope()
{
   try
   {
      // reslect the previously selected device if we had one
      if (pImpl_->pPreviousDevice != NULL)
         Rf_selectDevice(Rf_ndevNumber(pImpl_->pPreviousDevice->dev));  
   }
   catch(...)
   {
   }
}
Exemplo n.º 3
0
            void ide_device::output_and_kill_file_device() {
                rhost::util::errors_to_exceptions([&] {
                    // The device number is not constant, so get the current number
                    int file_device_num = Rf_ndevNumber(_file_device);

                    // Killing the device will call close, which will save the file to disk
                    pGEDevDesc ge_dev_desc = GEgetDevice(file_device_num);
                    GEkillDevice(ge_dev_desc);
                });

                // Blank our state, next call to graphics primitive (if any) will create 
                // a new file device on demand
                _file_device = nullptr;
                _file_device_filename = std::tr2::sys::path();
            }
Exemplo n.º 4
0
 void ide_device::select() {
     rhost::util::errors_to_exceptions([&] {
         auto num = Rf_ndevNumber(device_instance->device_desc);
         Rf_selectDevice(num);
     });
 }