1484 |
sigc::mem_fun(*this, &MainWindow::file_changed)); |
sigc::mem_fun(*this, &MainWindow::file_changed)); |
1485 |
instrumentProps.signal_changed().connect( |
instrumentProps.signal_changed().connect( |
1486 |
sigc::mem_fun(*this, &MainWindow::file_changed)); |
sigc::mem_fun(*this, &MainWindow::file_changed)); |
1487 |
propDialog.signal_changed().connect( |
sampleProps.signal_changed().connect( |
1488 |
|
sigc::mem_fun(*this, &MainWindow::file_changed)); |
1489 |
|
fileProps.signal_changed().connect( |
1490 |
sigc::mem_fun(*this, &MainWindow::file_changed)); |
sigc::mem_fun(*this, &MainWindow::file_changed)); |
1491 |
midiRules.signal_changed().connect( |
midiRules.signal_changed().connect( |
1492 |
sigc::mem_fun(*this, &MainWindow::file_changed)); |
sigc::mem_fun(*this, &MainWindow::file_changed)); |
2605 |
|
|
2606 |
void MainWindow::on_action_file_properties() |
void MainWindow::on_action_file_properties() |
2607 |
{ |
{ |
2608 |
propDialog.show(); |
fileProps.show(); |
2609 |
propDialog.deiconify(); |
fileProps.deiconify(); |
2610 |
} |
} |
2611 |
|
|
2612 |
void MainWindow::on_action_warn_user_on_extensions() { |
void MainWindow::on_action_warn_user_on_extensions() { |
2677 |
dialog.run(); |
dialog.run(); |
2678 |
} |
} |
2679 |
|
|
2680 |
PropDialog::PropDialog() |
FilePropDialog::FilePropDialog() |
2681 |
: eFileFormat(_("File Format")), |
: eFileFormat(_("File Format")), |
2682 |
eName(_("Name")), |
eName(_("Name")), |
2683 |
eCreationDate(_("Creation date")), |
eCreationDate(_("Creation date")), |
2711 |
set_title(_("File Properties")); |
set_title(_("File Properties")); |
2712 |
eName.set_width_chars(50); |
eName.set_width_chars(50); |
2713 |
|
|
2714 |
connect(eFileFormat, &PropDialog::set_FileFormat); |
connect(eFileFormat, &FilePropDialog::set_FileFormat); |
2715 |
connect(eName, &DLS::Info::Name); |
connect(eName, &DLS::Info::Name); |
2716 |
connect(eCreationDate, &DLS::Info::CreationDate); |
connect(eCreationDate, &DLS::Info::CreationDate); |
2717 |
connect(eComments, &DLS::Info::Comments); |
connect(eComments, &DLS::Info::Comments); |
2772 |
quitButton.set_can_default(); |
quitButton.set_can_default(); |
2773 |
quitButton.grab_focus(); |
quitButton.grab_focus(); |
2774 |
quitButton.signal_clicked().connect( |
quitButton.signal_clicked().connect( |
2775 |
sigc::mem_fun(*this, &PropDialog::hide)); |
sigc::mem_fun(*this, &FilePropDialog::hide)); |
2776 |
|
|
2777 |
quitButton.show(); |
quitButton.show(); |
2778 |
vbox.show(); |
vbox.show(); |
2781 |
#endif |
#endif |
2782 |
} |
} |
2783 |
|
|
2784 |
void PropDialog::set_file(gig::File* file) |
void FilePropDialog::set_file(gig::File* file) |
2785 |
{ |
{ |
2786 |
m_file = file; |
m_file = file; |
2787 |
update(file->pInfo); |
update(file->pInfo); |
2807 |
update_model--; |
update_model--; |
2808 |
} |
} |
2809 |
|
|
2810 |
void PropDialog::set_FileFormat(int value) |
void FilePropDialog::set_FileFormat(int value) |
2811 |
{ |
{ |
2812 |
m_file->pVersion->major = value; |
m_file->pVersion->major = value; |
2813 |
} |
} |
2851 |
eIsDrum(_("Is drum")), |
eIsDrum(_("Is drum")), |
2852 |
eMIDIBank(_("MIDI bank"), 0, 16383), |
eMIDIBank(_("MIDI bank"), 0, 16383), |
2853 |
eMIDIProgram(_("MIDI program")), |
eMIDIProgram(_("MIDI program")), |
2854 |
eAttenuation(_("Attenuation"), 0, 96, 0, 1), |
eAttenuation(_("Attenuation (dB)"), -96, +96, 0, 1), |
|
eGainPlus6(_("Gain +6dB"), eAttenuation, -6), |
|
2855 |
eEffectSend(_("Effect send"), 0, 65535), |
eEffectSend(_("Effect send"), 0, 65535), |
2856 |
eFineTune(_("Fine tune"), -8400, 8400), |
eFineTune(_("Fine tune"), -8400, 8400), |
2857 |
ePitchbendRange(_("Pitchbend range"), 0, 48), |
ePitchbendRange(_("Pitchbend range (halftones)"), 0, 48), |
2858 |
ePianoReleaseMode(_("Piano release mode")), |
ePianoReleaseMode(_("Piano release mode")), |
2859 |
eDimensionKeyRangeLow(_("Keyswitching range low")), |
eDimensionKeyRangeLow(_("Keyswitching range low")), |
2860 |
eDimensionKeyRangeHigh(_("Keyswitching range high")) |
eDimensionKeyRangeHigh(_("Keyswitching range high")), |
2861 |
|
table2(2,1), |
2862 |
|
eName2(_("Name")), |
2863 |
|
eCreationDate(_("Creation date")), |
2864 |
|
eComments(_("Comments")), |
2865 |
|
eProduct(_("Product")), |
2866 |
|
eCopyright(_("Copyright")), |
2867 |
|
eArtists(_("Artists")), |
2868 |
|
eGenre(_("Genre")), |
2869 |
|
eKeywords(_("Keywords")), |
2870 |
|
eEngineer(_("Engineer")), |
2871 |
|
eTechnician(_("Technician")), |
2872 |
|
eSoftware(_("Software")), |
2873 |
|
eMedium(_("Medium")), |
2874 |
|
eSource(_("Source")), |
2875 |
|
eSourceForm(_("Source form")), |
2876 |
|
eCommissioned(_("Commissioned")), |
2877 |
|
eSubject(_("Subject")) |
2878 |
{ |
{ |
2879 |
if (!Settings::singleton()->autoRestoreWindowDimension) { |
if (!Settings::singleton()->autoRestoreWindowDimension) { |
2880 |
//set_default_size(470, 390); |
//set_default_size(470, 390); |
2883 |
|
|
2884 |
set_title(_("Instrument Properties")); |
set_title(_("Instrument Properties")); |
2885 |
|
|
2886 |
|
tabs.append_page(vbox[1], _("Settings")); |
2887 |
|
tabs.append_page(vbox[2], _("Info")); |
2888 |
|
|
2889 |
eDimensionKeyRangeLow.set_tip( |
eDimensionKeyRangeLow.set_tip( |
2890 |
_("start of the keyboard area which should switch the " |
_("start of the keyboard area which should switch the " |
2891 |
"\"keyswitching\" dimension") |
"\"keyswitching\" dimension") |
2900 |
connect(eMIDIBank, &InstrumentProps::set_MIDIBank); |
connect(eMIDIBank, &InstrumentProps::set_MIDIBank); |
2901 |
connect(eMIDIProgram, &InstrumentProps::set_MIDIProgram); |
connect(eMIDIProgram, &InstrumentProps::set_MIDIProgram); |
2902 |
connect(eAttenuation, &gig::Instrument::Attenuation); |
connect(eAttenuation, &gig::Instrument::Attenuation); |
|
connect(eGainPlus6, &gig::Instrument::Attenuation); |
|
2903 |
connect(eEffectSend, &gig::Instrument::EffectSend); |
connect(eEffectSend, &gig::Instrument::EffectSend); |
2904 |
connect(eFineTune, &gig::Instrument::FineTune); |
connect(eFineTune, &gig::Instrument::FineTune); |
2905 |
connect(ePitchbendRange, &gig::Instrument::PitchbendRange); |
connect(ePitchbendRange, &gig::Instrument::PitchbendRange); |
2909 |
|
|
2910 |
eName.signal_value_changed().connect(sig_name_changed.make_slot()); |
eName.signal_value_changed().connect(sig_name_changed.make_slot()); |
2911 |
|
|
2912 |
|
connect(eName2, &InstrumentProps::set_Name); |
2913 |
|
connectLambda(eCreationDate, [this](gig::String s) { |
2914 |
|
m->pInfo->CreationDate = s; |
2915 |
|
}); |
2916 |
|
connectLambda(eComments, [this](gig::String s) { |
2917 |
|
m->pInfo->Comments = s; |
2918 |
|
}); |
2919 |
|
connectLambda(eProduct, [this](gig::String s) { |
2920 |
|
m->pInfo->Product = s; |
2921 |
|
}); |
2922 |
|
connectLambda(eCopyright, [this](gig::String s) { |
2923 |
|
m->pInfo->Copyright = s; |
2924 |
|
}); |
2925 |
|
connectLambda(eArtists, [this](gig::String s) { |
2926 |
|
m->pInfo->Artists = s; |
2927 |
|
}); |
2928 |
|
connectLambda(eGenre, [this](gig::String s) { |
2929 |
|
m->pInfo->Genre = s; |
2930 |
|
}); |
2931 |
|
connectLambda(eKeywords, [this](gig::String s) { |
2932 |
|
m->pInfo->Keywords = s; |
2933 |
|
}); |
2934 |
|
connectLambda(eEngineer, [this](gig::String s) { |
2935 |
|
m->pInfo->Engineer = s; |
2936 |
|
}); |
2937 |
|
connectLambda(eTechnician, [this](gig::String s) { |
2938 |
|
m->pInfo->Technician = s; |
2939 |
|
}); |
2940 |
|
connectLambda(eSoftware, [this](gig::String s) { |
2941 |
|
m->pInfo->Software = s; |
2942 |
|
}); |
2943 |
|
connectLambda(eMedium, [this](gig::String s) { |
2944 |
|
m->pInfo->Medium = s; |
2945 |
|
}); |
2946 |
|
connectLambda(eSource, [this](gig::String s) { |
2947 |
|
m->pInfo->Source = s; |
2948 |
|
}); |
2949 |
|
connectLambda(eSourceForm, [this](gig::String s) { |
2950 |
|
m->pInfo->SourceForm = s; |
2951 |
|
}); |
2952 |
|
connectLambda(eCommissioned, [this](gig::String s) { |
2953 |
|
m->pInfo->Commissioned = s; |
2954 |
|
}); |
2955 |
|
connectLambda(eSubject, [this](gig::String s) { |
2956 |
|
m->pInfo->Subject = s; |
2957 |
|
}); |
2958 |
|
|
2959 |
|
// tab 1 |
2960 |
#if USE_GTKMM_GRID |
#if USE_GTKMM_GRID |
2961 |
table.set_column_spacing(5); |
table.set_column_spacing(5); |
2962 |
#else |
#else |
2963 |
table.set_col_spacings(5); |
table.set_col_spacings(5); |
2964 |
#endif |
#endif |
|
|
|
2965 |
table.add(eName); |
table.add(eName); |
2966 |
table.add(eIsDrum); |
table.add(eIsDrum); |
2967 |
table.add(eMIDIBank); |
table.add(eMIDIBank); |
2968 |
table.add(eMIDIProgram); |
table.add(eMIDIProgram); |
2969 |
table.add(eAttenuation); |
table.add(eAttenuation); |
|
table.add(eGainPlus6); |
|
2970 |
table.add(eEffectSend); |
table.add(eEffectSend); |
2971 |
table.add(eFineTune); |
table.add(eFineTune); |
2972 |
table.add(ePitchbendRange); |
table.add(ePitchbendRange); |
2974 |
table.add(eDimensionKeyRangeLow); |
table.add(eDimensionKeyRangeLow); |
2975 |
table.add(eDimensionKeyRangeHigh); |
table.add(eDimensionKeyRangeHigh); |
2976 |
|
|
2977 |
add(vbox); |
// tab 2 |
2978 |
|
#if USE_GTKMM_GRID |
2979 |
|
table2.set_column_spacing(5); |
2980 |
|
#else |
2981 |
|
table2.set_col_spacings(5); |
2982 |
|
#endif |
2983 |
|
table2.add(eName2); |
2984 |
|
table2.add(eCreationDate); |
2985 |
|
table2.add(eComments); |
2986 |
|
table2.add(eProduct); |
2987 |
|
table2.add(eCopyright); |
2988 |
|
table2.add(eArtists); |
2989 |
|
table2.add(eGenre); |
2990 |
|
table2.add(eKeywords); |
2991 |
|
table2.add(eEngineer); |
2992 |
|
table2.add(eTechnician); |
2993 |
|
table2.add(eSoftware); |
2994 |
|
table2.add(eMedium); |
2995 |
|
table2.add(eSource); |
2996 |
|
table2.add(eSourceForm); |
2997 |
|
table2.add(eCommissioned); |
2998 |
|
table2.add(eSubject); |
2999 |
|
|
3000 |
|
add(vbox[0]); |
3001 |
#if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 24) |
#if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 24) |
3002 |
table.set_margin(5); |
table.set_margin(5); |
3003 |
#else |
#else |
3004 |
table.set_border_width(5); |
table.set_border_width(5); |
3005 |
#endif |
#endif |
3006 |
vbox.pack_start(table); |
vbox[1].pack_start(table); |
3007 |
|
vbox[2].pack_start(table2); |
3008 |
table.show(); |
table.show(); |
3009 |
vbox.pack_start(buttonBox, Gtk::PACK_SHRINK); |
table2.show(); |
3010 |
|
vbox[0].pack_start(tabs); |
3011 |
|
vbox[0].pack_start(buttonBox, Gtk::PACK_SHRINK); |
3012 |
buttonBox.set_layout(Gtk::BUTTONBOX_END); |
buttonBox.set_layout(Gtk::BUTTONBOX_END); |
3013 |
#if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 24) |
#if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 24) |
3014 |
buttonBox.set_margin(5); |
buttonBox.set_margin(5); |
3024 |
sigc::mem_fun(*this, &InstrumentProps::hide)); |
sigc::mem_fun(*this, &InstrumentProps::hide)); |
3025 |
|
|
3026 |
quitButton.show(); |
quitButton.show(); |
3027 |
vbox.show(); |
vbox[0].show(); |
3028 |
#if HAS_GTKMM_SHOW_ALL_CHILDREN |
#if HAS_GTKMM_SHOW_ALL_CHILDREN |
3029 |
show_all_children(); |
show_all_children(); |
3030 |
#endif |
#endif |
3035 |
update(instrument); |
update(instrument); |
3036 |
|
|
3037 |
update_model++; |
update_model++; |
3038 |
|
|
3039 |
|
// tab 1 |
3040 |
eName.set_value(instrument->pInfo->Name); |
eName.set_value(instrument->pInfo->Name); |
3041 |
eIsDrum.set_value(instrument->IsDrum); |
eIsDrum.set_value(instrument->IsDrum); |
3042 |
eMIDIBank.set_value(instrument->MIDIBank); |
eMIDIBank.set_value(instrument->MIDIBank); |
3043 |
eMIDIProgram.set_value(instrument->MIDIProgram); |
eMIDIProgram.set_value(instrument->MIDIProgram); |
3044 |
|
// tab 2 |
3045 |
|
eName2.set_value(instrument->pInfo->Name); |
3046 |
|
eCreationDate.set_value(instrument->pInfo->CreationDate); |
3047 |
|
eComments.set_value(instrument->pInfo->Comments); |
3048 |
|
eProduct.set_value(instrument->pInfo->Product); |
3049 |
|
eCopyright.set_value(instrument->pInfo->Copyright); |
3050 |
|
eArtists.set_value(instrument->pInfo->Artists); |
3051 |
|
eGenre.set_value(instrument->pInfo->Genre); |
3052 |
|
eKeywords.set_value(instrument->pInfo->Keywords); |
3053 |
|
eEngineer.set_value(instrument->pInfo->Engineer); |
3054 |
|
eTechnician.set_value(instrument->pInfo->Technician); |
3055 |
|
eSoftware.set_value(instrument->pInfo->Software); |
3056 |
|
eMedium.set_value(instrument->pInfo->Medium); |
3057 |
|
eSource.set_value(instrument->pInfo->Source); |
3058 |
|
eSourceForm.set_value(instrument->pInfo->SourceForm); |
3059 |
|
eCommissioned.set_value(instrument->pInfo->Commissioned); |
3060 |
|
eSubject.set_value(instrument->pInfo->Subject); |
3061 |
|
|
3062 |
|
update_model--; |
3063 |
|
} |
3064 |
|
|
3065 |
|
|
3066 |
|
SampleProps::SampleProps() : |
3067 |
|
#if HAS_GTKMM_STOCK |
3068 |
|
quitButton(Gtk::Stock::CLOSE), |
3069 |
|
#else |
3070 |
|
quitButton(_("_Close")), |
3071 |
|
#endif |
3072 |
|
table(2,1), |
3073 |
|
eName(_("Name")), |
3074 |
|
eUnityNote(_("Unity Note")), |
3075 |
|
eSampleGroup(_("Sample Group")), |
3076 |
|
eSampleFormatInfo(_("Sample Format")), |
3077 |
|
eSampleID("Sample ID"), |
3078 |
|
eChecksum("Wave Data CRC-32"), |
3079 |
|
eLoopsCount(_("Loops"), 0, 1), // we might support more than 1 loop in future |
3080 |
|
eLoopStart(_("Loop start position"), 0, 9999999), |
3081 |
|
eLoopLength(_("Loop size"), 0, 9999999), |
3082 |
|
eLoopType(_("Loop type")), |
3083 |
|
eLoopPlayCount(_("Playback count")), |
3084 |
|
table2(2,1), |
3085 |
|
eName2(_("Name")), |
3086 |
|
eCreationDate(_("Creation date")), |
3087 |
|
eComments(_("Comments")), |
3088 |
|
eProduct(_("Product")), |
3089 |
|
eCopyright(_("Copyright")), |
3090 |
|
eArtists(_("Artists")), |
3091 |
|
eGenre(_("Genre")), |
3092 |
|
eKeywords(_("Keywords")), |
3093 |
|
eEngineer(_("Engineer")), |
3094 |
|
eTechnician(_("Technician")), |
3095 |
|
eSoftware(_("Software")), |
3096 |
|
eMedium(_("Medium")), |
3097 |
|
eSource(_("Source")), |
3098 |
|
eSourceForm(_("Source form")), |
3099 |
|
eCommissioned(_("Commissioned")), |
3100 |
|
eSubject(_("Subject")) |
3101 |
|
{ |
3102 |
|
if (!Settings::singleton()->autoRestoreWindowDimension) { |
3103 |
|
//set_default_size(470, 390); |
3104 |
|
set_position(Gtk::WIN_POS_MOUSE); |
3105 |
|
} |
3106 |
|
|
3107 |
|
set_title(_("Sample Properties")); |
3108 |
|
|
3109 |
|
tabs.append_page(vbox[1], _("Settings")); |
3110 |
|
tabs.append_page(vbox[2], _("Info")); |
3111 |
|
|
3112 |
|
connect(eName, &SampleProps::set_Name); |
3113 |
|
connect(eUnityNote, &gig::Sample::MIDIUnityNote); |
3114 |
|
connect(eLoopsCount, &gig::Sample::Loops); |
3115 |
|
connectLambda(eLoopStart, [this](uint32_t start){ |
3116 |
|
m->LoopStart = start; |
3117 |
|
m->LoopEnd = start + m->LoopSize; |
3118 |
|
}); |
3119 |
|
connectLambda(eLoopLength, [this](uint32_t length){ |
3120 |
|
m->LoopSize = length; |
3121 |
|
m->LoopEnd = m->LoopStart + length; |
3122 |
|
}); |
3123 |
|
{ |
3124 |
|
const char* choices[] = { _("normal"), _("bidirectional"), _("backward"), 0 }; |
3125 |
|
static const gig::loop_type_t values[] = { |
3126 |
|
gig::loop_type_normal, |
3127 |
|
gig::loop_type_bidirectional, |
3128 |
|
gig::loop_type_backward |
3129 |
|
}; |
3130 |
|
eLoopType.set_choices(choices, values); |
3131 |
|
} |
3132 |
|
connect(eLoopType, &gig::Sample::LoopType); |
3133 |
|
connect(eLoopPlayCount, &gig::Sample::LoopPlayCount); |
3134 |
|
|
3135 |
|
eName.signal_value_changed().connect(sig_name_changed.make_slot()); |
3136 |
|
|
3137 |
|
connect(eName2, &SampleProps::set_Name); |
3138 |
|
connectLambda(eCreationDate, [this](gig::String s) { |
3139 |
|
m->pInfo->CreationDate = s; |
3140 |
|
}); |
3141 |
|
connectLambda(eComments, [this](gig::String s) { |
3142 |
|
m->pInfo->Comments = s; |
3143 |
|
}); |
3144 |
|
connectLambda(eProduct, [this](gig::String s) { |
3145 |
|
m->pInfo->Product = s; |
3146 |
|
}); |
3147 |
|
connectLambda(eCopyright, [this](gig::String s) { |
3148 |
|
m->pInfo->Copyright = s; |
3149 |
|
}); |
3150 |
|
connectLambda(eArtists, [this](gig::String s) { |
3151 |
|
m->pInfo->Artists = s; |
3152 |
|
}); |
3153 |
|
connectLambda(eGenre, [this](gig::String s) { |
3154 |
|
m->pInfo->Genre = s; |
3155 |
|
}); |
3156 |
|
connectLambda(eKeywords, [this](gig::String s) { |
3157 |
|
m->pInfo->Keywords = s; |
3158 |
|
}); |
3159 |
|
connectLambda(eEngineer, [this](gig::String s) { |
3160 |
|
m->pInfo->Engineer = s; |
3161 |
|
}); |
3162 |
|
connectLambda(eTechnician, [this](gig::String s) { |
3163 |
|
m->pInfo->Technician = s; |
3164 |
|
}); |
3165 |
|
connectLambda(eSoftware, [this](gig::String s) { |
3166 |
|
m->pInfo->Software = s; |
3167 |
|
}); |
3168 |
|
connectLambda(eMedium, [this](gig::String s) { |
3169 |
|
m->pInfo->Medium = s; |
3170 |
|
}); |
3171 |
|
connectLambda(eSource, [this](gig::String s) { |
3172 |
|
m->pInfo->Source = s; |
3173 |
|
}); |
3174 |
|
connectLambda(eSourceForm, [this](gig::String s) { |
3175 |
|
m->pInfo->SourceForm = s; |
3176 |
|
}); |
3177 |
|
connectLambda(eCommissioned, [this](gig::String s) { |
3178 |
|
m->pInfo->Commissioned = s; |
3179 |
|
}); |
3180 |
|
connectLambda(eSubject, [this](gig::String s) { |
3181 |
|
m->pInfo->Subject = s; |
3182 |
|
}); |
3183 |
|
|
3184 |
|
// tab 1 |
3185 |
|
#if USE_GTKMM_GRID |
3186 |
|
table.set_column_spacing(5); |
3187 |
|
#else |
3188 |
|
table.set_col_spacings(5); |
3189 |
|
#endif |
3190 |
|
table.add(eName); |
3191 |
|
table.add(eUnityNote); |
3192 |
|
table.add(eSampleGroup); |
3193 |
|
table.add(eSampleFormatInfo); |
3194 |
|
table.add(eSampleID); |
3195 |
|
table.add(eChecksum); |
3196 |
|
table.add(eLoopsCount); |
3197 |
|
table.add(eLoopStart); |
3198 |
|
table.add(eLoopLength); |
3199 |
|
table.add(eLoopType); |
3200 |
|
table.add(eLoopPlayCount); |
3201 |
|
|
3202 |
|
// tab 2 |
3203 |
|
#if USE_GTKMM_GRID |
3204 |
|
table2.set_column_spacing(5); |
3205 |
|
#else |
3206 |
|
table2.set_col_spacings(5); |
3207 |
|
#endif |
3208 |
|
table2.add(eName2); |
3209 |
|
table2.add(eCreationDate); |
3210 |
|
table2.add(eComments); |
3211 |
|
table2.add(eProduct); |
3212 |
|
table2.add(eCopyright); |
3213 |
|
table2.add(eArtists); |
3214 |
|
table2.add(eGenre); |
3215 |
|
table2.add(eKeywords); |
3216 |
|
table2.add(eEngineer); |
3217 |
|
table2.add(eTechnician); |
3218 |
|
table2.add(eSoftware); |
3219 |
|
table2.add(eMedium); |
3220 |
|
table2.add(eSource); |
3221 |
|
table2.add(eSourceForm); |
3222 |
|
table2.add(eCommissioned); |
3223 |
|
table2.add(eSubject); |
3224 |
|
|
3225 |
|
add(vbox[0]); |
3226 |
|
#if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 24) |
3227 |
|
table.set_margin(5); |
3228 |
|
#else |
3229 |
|
table.set_border_width(5); |
3230 |
|
#endif |
3231 |
|
vbox[1].pack_start(table); |
3232 |
|
vbox[2].pack_start(table2); |
3233 |
|
table.show(); |
3234 |
|
table2.show(); |
3235 |
|
vbox[0].pack_start(tabs); |
3236 |
|
vbox[0].pack_start(buttonBox, Gtk::PACK_SHRINK); |
3237 |
|
buttonBox.set_layout(Gtk::BUTTONBOX_END); |
3238 |
|
#if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 24) |
3239 |
|
buttonBox.set_margin(5); |
3240 |
|
#else |
3241 |
|
buttonBox.set_border_width(5); |
3242 |
|
#endif |
3243 |
|
buttonBox.show(); |
3244 |
|
buttonBox.pack_start(quitButton); |
3245 |
|
quitButton.set_can_default(); |
3246 |
|
quitButton.grab_focus(); |
3247 |
|
|
3248 |
|
quitButton.signal_clicked().connect( |
3249 |
|
sigc::mem_fun(*this, &SampleProps::hide)); |
3250 |
|
|
3251 |
|
quitButton.show(); |
3252 |
|
vbox[0].show(); |
3253 |
|
#if HAS_GTKMM_SHOW_ALL_CHILDREN |
3254 |
|
show_all_children(); |
3255 |
|
#endif |
3256 |
|
} |
3257 |
|
|
3258 |
|
void SampleProps::set_sample(gig::Sample* sample) |
3259 |
|
{ |
3260 |
|
update(sample); |
3261 |
|
|
3262 |
|
update_model++; |
3263 |
|
|
3264 |
|
// tab 1 |
3265 |
|
eName.set_value(sample->pInfo->Name); |
3266 |
|
eUnityNote.set_value(sample->MIDIUnityNote); |
3267 |
|
// show sample group name |
3268 |
|
{ |
3269 |
|
Glib::ustring s = "---"; |
3270 |
|
if (sample && sample->GetGroup()) |
3271 |
|
s = sample->GetGroup()->Name; |
3272 |
|
eSampleGroup.text.set_text(s); |
3273 |
|
} |
3274 |
|
// assemble sample format info string |
3275 |
|
{ |
3276 |
|
Glib::ustring s; |
3277 |
|
if (sample) { |
3278 |
|
switch (sample->Channels) { |
3279 |
|
case 1: s = _("Mono"); break; |
3280 |
|
case 2: s = _("Stereo"); break; |
3281 |
|
default: |
3282 |
|
s = ToString(sample->Channels) + _(" audio channels"); |
3283 |
|
break; |
3284 |
|
} |
3285 |
|
s += " " + ToString(sample->BitDepth) + " Bits"; |
3286 |
|
s += " " + ToString(sample->SamplesPerSecond/1000) + "." |
3287 |
|
+ ToString((sample->SamplesPerSecond%1000)/100) + " kHz"; |
3288 |
|
} else { |
3289 |
|
s = _("No sample assigned to this dimension region."); |
3290 |
|
} |
3291 |
|
eSampleFormatInfo.text.set_text(s); |
3292 |
|
} |
3293 |
|
// generate sample's memory address pointer string |
3294 |
|
{ |
3295 |
|
Glib::ustring s; |
3296 |
|
if (sample) { |
3297 |
|
char buf[64] = {}; |
3298 |
|
snprintf(buf, sizeof(buf), "%p", sample); |
3299 |
|
s = buf; |
3300 |
|
} else { |
3301 |
|
s = "---"; |
3302 |
|
} |
3303 |
|
eSampleID.text.set_text(s); |
3304 |
|
} |
3305 |
|
// generate raw wave form data CRC-32 checksum string |
3306 |
|
{ |
3307 |
|
Glib::ustring s = "---"; |
3308 |
|
if (sample) { |
3309 |
|
char buf[64] = {}; |
3310 |
|
snprintf(buf, sizeof(buf), "%x", sample->GetWaveDataCRC32Checksum()); |
3311 |
|
s = buf; |
3312 |
|
} |
3313 |
|
eChecksum.text.set_text(s); |
3314 |
|
} |
3315 |
|
eLoopsCount.set_value(sample->Loops); |
3316 |
|
eLoopStart.set_value(sample->LoopStart); |
3317 |
|
eLoopLength.set_value(sample->LoopSize); |
3318 |
|
eLoopType.set_value(sample->LoopType); |
3319 |
|
eLoopPlayCount.set_value(sample->LoopPlayCount); |
3320 |
|
// tab 2 |
3321 |
|
eName2.set_value(sample->pInfo->Name); |
3322 |
|
eCreationDate.set_value(sample->pInfo->CreationDate); |
3323 |
|
eComments.set_value(sample->pInfo->Comments); |
3324 |
|
eProduct.set_value(sample->pInfo->Product); |
3325 |
|
eCopyright.set_value(sample->pInfo->Copyright); |
3326 |
|
eArtists.set_value(sample->pInfo->Artists); |
3327 |
|
eGenre.set_value(sample->pInfo->Genre); |
3328 |
|
eKeywords.set_value(sample->pInfo->Keywords); |
3329 |
|
eEngineer.set_value(sample->pInfo->Engineer); |
3330 |
|
eTechnician.set_value(sample->pInfo->Technician); |
3331 |
|
eSoftware.set_value(sample->pInfo->Software); |
3332 |
|
eMedium.set_value(sample->pInfo->Medium); |
3333 |
|
eSource.set_value(sample->pInfo->Source); |
3334 |
|
eSourceForm.set_value(sample->pInfo->SourceForm); |
3335 |
|
eCommissioned.set_value(sample->pInfo->Commissioned); |
3336 |
|
eSubject.set_value(sample->pInfo->Subject); |
3337 |
|
|
3338 |
|
update_model--; |
3339 |
|
} |
3340 |
|
|
3341 |
|
void SampleProps::set_Name(const gig::String& name) |
3342 |
|
{ |
3343 |
|
m->pInfo->Name = name; |
3344 |
|
} |
3345 |
|
|
3346 |
|
void SampleProps::update_name() |
3347 |
|
{ |
3348 |
|
update_model++; |
3349 |
|
eName.set_value(m->pInfo->Name); |
3350 |
update_model--; |
update_model--; |
3351 |
} |
} |
3352 |
|
|
3442 |
file_has_name = filename; |
file_has_name = filename; |
3443 |
file_is_changed = false; |
file_is_changed = false; |
3444 |
|
|
3445 |
propDialog.set_file(gig); |
fileProps.set_file(gig); |
3446 |
|
|
3447 |
instrument_name_connection.block(); |
instrument_name_connection.block(); |
3448 |
int index = 0; |
int index = 0; |
3582 |
} |
} |
3583 |
} |
} |
3584 |
|
|
3585 |
|
bool MainWindow::sample_props_set_sample() |
3586 |
|
{ |
3587 |
|
sampleProps.signal_name_changed().clear(); |
3588 |
|
|
3589 |
|
std::vector<Gtk::TreeModel::Path> rows = m_TreeViewSamples.get_selection()->get_selected_rows(); |
3590 |
|
if (rows.empty()) { |
3591 |
|
sampleProps.hide(); |
3592 |
|
return false; |
3593 |
|
} |
3594 |
|
//NOTE: was const_iterator before, which did not compile with GTKMM4 development branch, probably going to be fixed before final GTKMM4 release though. |
3595 |
|
Gtk::TreeModel::iterator it = m_refSamplesTreeModel->get_iter(rows[0]); |
3596 |
|
if (it) { |
3597 |
|
Gtk::TreeModel::Row row = *it; |
3598 |
|
gig::Sample* sample = row[m_SamplesModel.m_col_sample]; |
3599 |
|
|
3600 |
|
sampleProps.set_sample(sample); |
3601 |
|
|
3602 |
|
// make sure sample tree is updated when user changes the |
3603 |
|
// sample name in sample properties window |
3604 |
|
sampleProps.signal_name_changed().connect( |
3605 |
|
sigc::bind( |
3606 |
|
sigc::mem_fun(*this, |
3607 |
|
&MainWindow::sample_name_changed_by_sample_props |
3608 |
|
), it |
3609 |
|
) |
3610 |
|
); |
3611 |
|
} else { |
3612 |
|
sampleProps.hide(); |
3613 |
|
} |
3614 |
|
//NOTE: explicit boolean cast required for GTKMM4 development branch here |
3615 |
|
return it ? true : false; |
3616 |
|
} |
3617 |
|
|
3618 |
|
void MainWindow::show_sample_props() |
3619 |
|
{ |
3620 |
|
if (sample_props_set_sample()) { |
3621 |
|
sampleProps.show(); |
3622 |
|
sampleProps.deiconify(); |
3623 |
|
} |
3624 |
|
} |
3625 |
|
|
3626 |
|
void MainWindow::sample_name_changed_by_sample_props(Gtk::TreeModel::iterator& it) |
3627 |
|
{ |
3628 |
|
Gtk::TreeModel::Row row = *it; |
3629 |
|
Glib::ustring name = row[m_SamplesModel.m_col_name]; |
3630 |
|
|
3631 |
|
gig::Sample* sample = row[m_SamplesModel.m_col_sample]; |
3632 |
|
Glib::ustring gigname(gig_to_utf8(sample->pInfo->Name)); |
3633 |
|
if (gigname != name) { |
3634 |
|
Gtk::TreeModel::Path path(*it); |
3635 |
|
row[m_SamplesModel.m_col_name] = gigname; |
3636 |
|
} |
3637 |
|
} |
3638 |
|
|
3639 |
void MainWindow::show_midi_rules() |
void MainWindow::show_midi_rules() |
3640 |
{ |
{ |
3641 |
if (gig::Instrument* instrument = get_instrument()) |
if (gig::Instrument* instrument = get_instrument()) |
4342 |
} |
} |
4343 |
|
|
4344 |
void MainWindow::on_action_sample_properties() { |
void MainWindow::on_action_sample_properties() { |
4345 |
//TODO: show a dialog where the selected sample's properties can be edited |
show_sample_props(); |
|
Gtk::MessageDialog msg( |
|
|
*this, _("Sorry, yet to be implemented!"), false, Gtk::MESSAGE_INFO |
|
|
); |
|
|
msg.run(); |
|
4346 |
} |
} |
4347 |
|
|
4348 |
void MainWindow::on_action_add_script_group() { |
void MainWindow::on_action_add_script_group() { |
5141 |
file_changed(); |
file_changed(); |
5142 |
} |
} |
5143 |
} |
} |
5144 |
|
// change name in the sample properties window |
5145 |
|
if (sampleProps.get_sample() == sample && sample) { |
5146 |
|
sampleProps.set_sample(sample); |
5147 |
|
} |
5148 |
} |
} |
5149 |
|
|
5150 |
void MainWindow::script_name_changed(const Gtk::TreeModel::Path& path, |
void MainWindow::script_name_changed(const Gtk::TreeModel::Path& path, |