pub unsafe fn context_menu_update(&self) {

        // Disable everything, just in case.
        self.context_menu_add_rows.set_enabled(false);
        self.context_menu_insert_rows.set_enabled(false);
        self.context_menu_clone_and_append.set_enabled(false);
        self.context_menu_clone_and_insert.set_enabled(false);
        self.context_menu_delete_rows.set_enabled(false);
        self.context_menu_delete_rows_not_in_filter.set_enabled(false);
        self.context_menu_paste.set_enabled(false);
        self.context_menu_paste_as_new_row.set_enabled(false);
        self.context_menu_rewrite_selection.set_enabled(false);
        self.context_menu_generate_ids.set_enabled(false);
        self.context_menu_undo.set_enabled(false);
        self.context_menu_redo.set_enabled(false);
        self.context_menu_import_tsv.set_enabled(false);
        self.context_menu_cascade_edition.set_enabled(false);
        self.context_menu_patch_column.set_enabled(true);
        self.smart_delete.set_enabled(false);

        // Turns out that this slot doesn't give the the amount of selected items, so we have to get them ourselves.
        let indexes = self.table_filter.map_selection_to_source(&self.table_view_primary.selection_model().selection()).indexes();

        // If we have something selected, enable these actions.
        if indexes.count_0a() > 0 {
            self.context_menu_copy.set_enabled(true);
            self.context_menu_copy_as_lua_table.set_enabled(true);

            if *self.packed_file_type == PackedFileType::DB {
                self.context_menu_go_to_loc.iter().for_each(|x| x.set_enabled(true));
            } else {
                self.context_menu_go_to_loc.iter().for_each(|x| x.set_enabled(false));
            }

            if [PackedFileType::DB, PackedFileType::Loc].contains(&self.packed_file_type) {
                self.context_menu_go_to_definition.set_enabled(true);
            } else {
                self.context_menu_go_to_definition.set_enabled(false);
            }
        }

        // Otherwise, disable them.
        else {
            self.context_menu_copy.set_enabled(false);
            self.context_menu_copy_as_lua_table.set_enabled(false);
            self.context_menu_go_to_definition.set_enabled(false);
            self.context_menu_go_to_loc.iter().for_each(|x| x.set_enabled(false));
        }

        // Only enable editing if the table is ours and not banned.
        if let DataSource::PackFile = self.get_data_source() {
            if !self.banned_table {

                // These ones are always enabled if the table is editable.
                self.context_menu_add_rows.set_enabled(true);
                self.context_menu_insert_rows.set_enabled(true);
                self.context_menu_delete_rows_not_in_filter.set_enabled(true);
                self.context_menu_paste_as_new_row.set_enabled(true);
                self.context_menu_import_tsv.set_enabled(true);
                self.smart_delete.set_enabled(true);

                // If we have something selected, enable these actions.
                if indexes.count_0a() > 0 {
                    self.context_menu_clone_and_append.set_enabled(true);
                    self.context_menu_clone_and_insert.set_enabled(true);
                    self.context_menu_delete_rows.set_enabled(true);
                    self.context_menu_paste.set_enabled(true);
                    self.context_menu_rewrite_selection.set_enabled(true);
                    self.context_menu_generate_ids.set_enabled(true);
                    self.context_menu_cascade_edition.set_enabled(true);
                }

                if !self.undo_lock.load(Ordering::SeqCst) {
                    self.context_menu_undo.set_enabled(!self.history_undo.read().unwrap().is_empty());
                    self.context_menu_redo.set_enabled(!self.history_redo.read().unwrap().is_empty());
                }
            }
        }
    }
/// This function updates the state of the actions in the context menu.
This function updates the state of the actions in the context menu.
This function updates the state of the actions in the context menu .
pub unsafe fn context_menu_update(&self) {
        // Disable everything, just in case.
        self.context_menu_add_rows.set_enabled(false);
        self.context_menu_insert_rows.set_enabled(false);
        self.context_menu_clone_and_append.set_enabled(false);
        self.context_menu_clone_and_insert.set_enabled(false);
        self.context_menu_delete_rows.set_enabled(false);
        self.context_menu_delete_rows_not_in_filter.set_enabled(false);
        self.context_menu_paste.set_enabled(false);
        self.context_menu_paste_as_new_row.set_enabled(false);
        self.context_menu_rewrite_selection.set_enabled(false);
        self.context_menu_generate_ids.set_enabled(false);
        self.context_menu_undo.set_enabled(false);
        self.context_menu_redo.set_enabled(false);
        self.context_menu_import_tsv.set_enabled(false);
        self.context_menu_cascade_edition.set_enabled(false);
        self.context_menu_patch_column.set_enabled(true);
        self.smart_delete.set_enabled(false);
        // Turns out that this slot doesn't give the the amount of selected items, so we have to get them ourselves.
        let indexes = self.table_filter.map_selection_to_source(&self.table_view_primary.selection_model().selection()).indexes();
        // If we have something selected, enable these actions.
        if indexes.count_0a() > 0 {
            self.context_menu_copy.set_enabled(true);
            self.context_menu_copy_as_lua_table.set_enabled(true);
            if *self.packed_file_type == PackedFileType::DB {
                self.context_menu_go_to_loc.iter().for_each(|x| x.set_enabled(true));
            } else {
                self.context_menu_go_to_loc.iter().for_each(|x| x.set_enabled(false));
            }
            if [PackedFileType::DB, PackedFileType::Loc].contains(&self.packed_file_type) {
                self.context_menu_go_to_definition.set_enabled(true);
            } else {
                self.context_menu_go_to_definition.set_enabled(false);
            }
        }
        // Otherwise, disable them.
        else {
            self.context_menu_copy.set_enabled(false);
            self.context_menu_copy_as_lua_table.set_enabled(false);
            self.context_menu_go_to_definition.set_enabled(false);
            self.context_menu_go_to_loc.iter().for_each(|x| x.set_enabled(false));
        }
        // Only enable editing if the table is ours and not banned.
        if let DataSource::PackFile = self.get_data_source() {
            if !self.banned_table {
                // These ones are always enabled if the table is editable.
                self.context_menu_add_rows.set_enabled(true);
                self.context_menu_insert_rows.set_enabled(true);
                self.context_menu_delete_rows_not_in_filter.set_enabled(true);
                self.context_menu_paste_as_new_row.set_enabled(true);
                self.context_menu_import_tsv.set_enabled(true);
                self.smart_delete.set_enabled(true);
                // If we have something selected, enable these actions.
                if indexes.count_0a() > 0 {
                    self.context_menu_clone_and_append.set_enabled(true);
                    self.context_menu_clone_and_insert.set_enabled(true);
                    self.context_menu_delete_rows.set_enabled(true);
                    self.context_menu_paste.set_enabled(true);
                    self.context_menu_rewrite_selection.set_enabled(true);
                    self.context_menu_generate_ids.set_enabled(true);
                    self.context_menu_cascade_edition.set_enabled(true);
                }
                if !self.undo_lock.load(Ordering::SeqCst) {
                    self.context_menu_undo.set_enabled(!self.history_undo.read().unwrap().is_empty());
                    self.context_menu_redo.set_enabled(!self.history_redo.read().unwrap().is_empty());
                }
            }
        }
    }
pub unsafe fn context_menu_update ( & self ) { // Disable everything, just in case. self . context_menu_add_rows . set_enabled ( false ) ; self . context_menu_insert_rows . set_enabled ( false ) ; self . context_menu_clone_and_append . set_enabled ( false ) ; self . context_menu_clone_and_insert . set_enabled ( false ) ; self . context_menu_delete_rows . set_enabled ( false ) ; self . context_menu_delete_rows_not_in_filter . set_enabled ( false ) ; self . context_menu_paste . set_enabled ( false ) ; self . context_menu_paste_as_new_row . set_enabled ( false ) ; self . context_menu_rewrite_selection . set_enabled ( false ) ; self . context_menu_generate_ids . set_enabled ( false ) ; self . context_menu_undo . set_enabled ( false ) ; self . context_menu_redo . set_enabled ( false ) ; self . context_menu_import_tsv . set_enabled ( false ) ; self . context_menu_cascade_edition . set_enabled ( false ) ; self . context_menu_patch_column . set_enabled ( true ) ; self . smart_delete . set_enabled ( false ) ; // Turns out that this slot doesn't give the the amount of selected items, so we have to get them ourselves. let indexes = self . table_filter . map_selection_to_source ( & self . table_view_primary . selection_model ( ) . selection ( ) ) . indexes ( ) ; // If we have something selected, enable these actions. if indexes . count_0a ( ) > 0 { self . context_menu_copy . set_enabled ( true ) ; self . context_menu_copy_as_lua_table . set_enabled ( true ) ; if * self . packed_file_type == PackedFileType :: DB { self . context_menu_go_to_loc . iter ( ) . for_each ( | x | x . set_enabled ( true ) ) ; } else { self . context_menu_go_to_loc . iter ( ) . for_each ( | x | x . set_enabled ( false ) ) ; } if [ PackedFileType :: DB , PackedFileType :: Loc ] . contains ( & self . packed_file_type ) { self . context_menu_go_to_definition . set_enabled ( true ) ; } else { self . context_menu_go_to_definition . set_enabled ( false ) ; } } // Otherwise, disable them. else { self . context_menu_copy . set_enabled ( false ) ; self . context_menu_copy_as_lua_table . set_enabled ( false ) ; self . context_menu_go_to_definition . set_enabled ( false ) ; self . context_menu_go_to_loc . iter ( ) . for_each ( | x | x . set_enabled ( false ) ) ; } // Only enable editing if the table is ours and not banned. if let DataSource :: PackFile = self . get_data_source ( ) { if ! self . banned_table { // These ones are always enabled if the table is editable. self . context_menu_add_rows . set_enabled ( true ) ; self . context_menu_insert_rows . set_enabled ( true ) ; self . context_menu_delete_rows_not_in_filter . set_enabled ( true ) ; self . context_menu_paste_as_new_row . set_enabled ( true ) ; self . context_menu_import_tsv . set_enabled ( true ) ; self . smart_delete . set_enabled ( true ) ; // If we have something selected, enable these actions. if indexes . count_0a ( ) > 0 { self . context_menu_clone_and_append . set_enabled ( true ) ; self . context_menu_clone_and_insert . set_enabled ( true ) ; self . context_menu_delete_rows . set_enabled ( true ) ; self . context_menu_paste . set_enabled ( true ) ; self . context_menu_rewrite_selection . set_enabled ( true ) ; self . context_menu_generate_ids . set_enabled ( true ) ; self . context_menu_cascade_edition . set_enabled ( true ) ; } if ! self . undo_lock . load ( Ordering :: SeqCst ) { self . context_menu_undo . set_enabled ( ! self . history_undo . read ( ) . unwrap ( ) . is_empty ( ) ) ; self . context_menu_redo . set_enabled ( ! self . history_redo . read ( ) . unwrap ( ) . is_empty ( ) ) ; } } } }
This function updates the state of the actions in the context menu.
This function updates the state of the actions in the context menu .
&self
&self